Merge "Add $namespaceGenderAliases for 'eo'"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
33
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
40
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
46
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
51
52 !! article
53 Template:pipe
54 !! text
55 |
56 !! endarticle
57
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
63
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
69
70 !! article
71 Template:tbl-start
72 !! text
73 {|
74 !! endarticle
75
76 !! article
77 Template:tbl-end
78 !! text
79 |}
80 !! endarticle
81
82 !! article
83 Template:!
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
93
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
99
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
105
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
111
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
118
119 !! article
120 A?b
121 !! text
122 Weirdo titles!
123 !! endarticle
124
125 ###
126 ### Basic tests
127 ###
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
133
134
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
143
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
147 foo
148
149 bar
150
151
152 baz
153
154
155
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
161 baz
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with newline spacing with comment lines in between
169 !! input
170 ----
171 a
172 <!--foo-->
173 b
174 ----
175 a
176 <!--foo--><!--More than 1 comment disables stripping of this line!-->
177 b
178 ----
179 a
180 <!--foo-->
181
182 b
183 ----
184 a
185
186 <!--foo-->
187 b
188 ----
189 a
190 <!--foo-->
191
192
193 b
194 ----
195 a
196
197
198 <!--foo-->
199 b
200 ----
201 !! result
202 <hr />
203 <p>a
204 b
205 </p>
206 <hr />
207 <p>a
208 </p><p>b
209 </p>
210 <hr />
211 <p>a
212 </p><p>b
213 </p>
214 <hr />
215 <p>a
216 </p><p>b
217 </p>
218 <hr />
219 <p>a
220 </p><p><br />
221 b
222 </p>
223 <hr />
224 <p>a
225 </p><p><br />
226 b
227 </p>
228 <hr />
229
230 !! end
231
232 !! test
233 Paragraphs with newline spacing with non-empty white-space lines in between
234 !! input
235 ----
236 a
237
238 b
239 ----
240 a
241
242
243 b
244 ----
245 !! result
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br />
253 b
254 </p>
255 <hr />
256
257 !! end
258
259 !! test
260 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
261 !! input
262 ----
263 a
264 <!--foo-->
265 b
266 ----
267 a
268 <!--foo--><!--More than 1 comment disables stripping of this line!-->
269 b
270 ----
271 a
272
273 <!--foo-->
274 <!--bar-->
275 b
276 ----
277 a
278
279 <!--foo-->
280 <!--bar-->
281
282 b
283 ----
284 !! result
285 <hr />
286 <p>a
287 b
288 </p>
289 <hr />
290 <p>a
291 </p><p>b
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
300 b
301 </p>
302 <hr />
303
304 !! end
305
306 !! test
307 Parsing an URL
308 !! input
309 http://fr.wikipedia.org/wiki/🍺
310 <!-- EasterEgg we love beer, better be able be able to link to it -->
311 !! result
312 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
313 </p>
314 !! end
315
316 !! test
317 Simple list
318 !! input
319 * Item 1
320 * Item 2
321 !! result
322 <ul><li> Item 1
323 </li><li> Item 2
324 </li></ul>
325
326 !! end
327
328 !! test
329 Italics and bold
330 !! input
331 * plain
332 * plain''italic''plain
333 * plain''italic''plain''italic''plain
334 * plain'''bold'''plain
335 * plain'''bold'''plain'''bold'''plain
336 * plain''italic''plain'''bold'''plain
337 * plain'''bold'''plain''italic''plain
338 * plain''italic'''bold-italic'''italic''plain
339 * plain'''bold''bold-italic''bold'''plain
340 * plain'''''bold-italic'''italic''plain
341 * plain'''''bold-italic''bold'''plain
342 * plain''italic'''bold-italic'''''plain
343 * plain'''bold''bold-italic'''''plain
344 * plain l'''italic''plain
345 * plain l''''bold''' plain
346 !! result
347 <ul><li> plain
348 </li><li> plain<i>italic</i>plain
349 </li><li> plain<i>italic</i>plain<i>italic</i>plain
350 </li><li> plain<b>bold</b>plain
351 </li><li> plain<b>bold</b>plain<b>bold</b>plain
352 </li><li> plain<i>italic</i>plain<b>bold</b>plain
353 </li><li> plain<b>bold</b>plain<i>italic</i>plain
354 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
355 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
356 </li><li> plain<i><b>bold-italic</b>italic</i>plain
357 </li><li> plain<b><i>bold-italic</i>bold</b>plain
358 </li><li> plain<i>italic<b>bold-italic</b></i>plain
359 </li><li> plain<b>bold<i>bold-italic</i></b>plain
360 </li><li> plain l'<i>italic</i>plain
361 </li><li> plain l'<b>bold</b> plain
362 </li></ul>
363
364 !! end
365
366 # this example taken from the simple/Moon article
367 !! test
368 Italics and possessives
369 !! input
370 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
371 !! result
372 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
373 </p>
374 !! end
375
376 ###
377 ### 2-quote opening sequence tests
378 ###
379 !! test
380 Italics and bold: 2-quote opening sequence: (2,2)
381 !! input
382 ''foo''
383 !! result
384 <p><i>foo</i>
385 </p>
386 !!end
387
388
389 !! test
390 Italics and bold: 2-quote opening sequence: (2,3)
391 !! input
392 ''foo'''
393 !! result
394 <p><i>foo'</i>
395 </p>
396 !!end
397
398
399 !! test
400 Italics and bold: 2-quote opening sequence: (2,4)
401 !! input
402 ''foo''''
403 !! result
404 <p><i>foo''</i>
405 </p>
406 !!end
407
408
409 !! test
410 Italics and bold: 2-quote opening sequence: (2,5) (php)
411 !! options
412 php
413 !! input
414 ''foo'''''
415 !! result
416 <p><i>foo</i>
417 </p>
418 !!end
419 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
420 !! test
421 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
422 !! options
423 parsoid
424 !! input
425 ''foo'''''
426 !! result
427 <p><i>foo</i><b></b>
428 </p>
429 !!end
430
431
432 ###
433 ### 3-quote opening sequence tests
434 ###
435
436 !! test
437 Italics and bold: 3-quote opening sequence: (3,2)
438 !! input
439 '''foo''
440 !! result
441 <p>'<i>foo</i>
442 </p>
443 !!end
444
445
446 !! test
447 Italics and bold: 3-quote opening sequence: (3,3)
448 !! input
449 '''foo'''
450 !! result
451 <p><b>foo</b>
452 </p>
453 !!end
454
455
456 !! test
457 Italics and bold: 3-quote opening sequence: (3,4)
458 !! input
459 '''foo''''
460 !! result
461 <p><b>foo'</b>
462 </p>
463 !!end
464
465
466 !! test
467 Italics and bold: 3-quote opening sequence: (3,5) (php)
468 !! options
469 php
470 !! input
471 '''foo'''''
472 !! result
473 <p><b>foo</b>
474 </p>
475 !!end
476 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
477 !! test
478 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
479 !! options
480 parsoid
481 !! input
482 '''foo'''''
483 !! result
484 <p><b>foo<i></i></b>
485 </p>
486 !!end
487
488
489 ###
490 ### 4-quote opening sequence tests
491 ###
492
493 !! test
494 Italics and bold: 4-quote opening sequence: (4,2)
495 !! input
496 ''''foo''
497 !! result
498 <p>''<i>foo</i>
499 </p>
500 !!end
501
502
503 !! test
504 Italics and bold: 4-quote opening sequence: (4,3)
505 !! input
506 ''''foo'''
507 !! result
508 <p>'<b>foo</b>
509 </p>
510 !!end
511
512
513 !! test
514 Italics and bold: 4-quote opening sequence: (4,4)
515 !! input
516 ''''foo''''
517 !! result
518 <p>'<b>foo'</b>
519 </p>
520 !!end
521
522
523 !! test
524 Italics and bold: 4-quote opening sequence: (4,5) (php)
525 !! options
526 php
527 !! input
528 ''''foo'''''
529 !! result
530 <p>'<b>foo</b>
531 </p>
532 !!end
533 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
534 !! test
535 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
536 !! options
537 parsoid
538 !! input
539 ''''foo'''''
540 !! result
541 <p>'<b>foo<i></i></b>
542 </p>
543 !!end
544
545
546 ###
547 ### 5-quote opening sequence tests
548 ###
549
550 !! test
551 Italics and bold: 5-quote opening sequence: (5,2) (php)
552 !! options
553 php
554 !! input
555 '''''foo''
556 !! result
557 <p><b><i>foo</i></b>
558 </p>
559 !!end
560 # Parsoid reverses the nesting order, compared to the PHP parser
561 !! test
562 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
563 !! options
564 parsoid
565 !! input
566 '''''foo''
567 !! result
568 <p><i><b>foo</b></i>
569 </p>
570 !!end
571
572
573 !! test
574 Italics and bold: 5-quote opening sequence: (5,3)
575 !! input
576 '''''foo'''
577 !! result
578 <p><i><b>foo</b></i>
579 </p>
580 !!end
581
582
583 !! test
584 Italics and bold: 5-quote opening sequence: (5,4)
585 !! input
586 '''''foo''''
587 !! result
588 <p><i><b>foo'</b></i>
589 </p>
590 !!end
591
592
593 !! test
594 Italics and bold: 5-quote opening sequence: (5,5)
595 !! input
596 '''''foo'''''
597 !! result
598 <p><i><b>foo</b></i>
599 </p>
600 !!end
601
602 ###
603 ### multiple quote sequences in a line
604 ###
605 !! test
606 Italics and bold: multiple quote sequences: (2,4,2)
607 !! input
608 ''foo''''bar''
609 !! result
610 <p><i>foo'<b>bar</b></i>
611 </p>
612 !!end
613
614
615 !! test
616 Italics and bold: multiple quote sequences: (2,4,3)
617 !! input
618 ''foo''''bar'''
619 !! result
620 <p><i>foo'<b>bar</b></i>
621 </p>
622 !!end
623
624
625 !! test
626 Italics and bold: multiple quote sequences: (2,4,4)
627 !! input
628 ''foo''''bar''''
629 !! result
630 <p><i>foo'<b>bar'</b></i>
631 </p>
632 !!end
633
634
635 !! test
636 Italics and bold: multiple quote sequences: (3,4,2) (php)
637 !! options
638 php
639 !! input
640 '''foo''''bar''
641 !! result
642 <p><b>foo'</b>bar
643 </p>
644 !!end
645 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
646 !! test
647 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
648 !! options
649 parsoid
650 !! input
651 '''foo''''bar''
652 !! result
653 <p><b>foo'</b>bar<i></i>
654 </p>
655 !!end
656
657
658 !! test
659 Italics and bold: multiple quote sequences: (3,4,3) (php)
660 !! options
661 php
662 !! input
663 '''foo''''bar'''
664 !! result
665 <p><b>foo'</b>bar
666 </p>
667 !!end
668 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
669 !! test
670 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
671 !! options
672 parsoid
673 !! input
674 '''foo''''bar'''
675 !! result
676 <p><b>foo'</b>bar<b></b>
677 </p>
678 !!end
679
680 ###
681 ### other quote tests
682 ###
683 !! test
684 Italics and bold: other quote tests: (2,3,5)
685 !! input
686 ''this is about '''foo's family'''''
687 !! result
688 <p><i>this is about <b>foo's family</b></i>
689 </p>
690 !!end
691
692
693 !! test
694 Italics and bold: other quote tests: (2,(3,3),2)
695 !! input
696 ''this is about '''foo's''' family''
697 !! result
698 <p><i>this is about <b>foo's</b> family</i>
699 </p>
700 !!end
701
702
703 !! test
704 Italics and bold: other quote tests: (3,2,3,2)
705 !! input
706 '''this is about ''foo'''s family''
707 !! result
708 <p><b>this is about <i>foo</i></b><i>s family</i>
709 </p>
710 !!end
711
712
713 # The Parsoid team believes the PHP parser's output on this test is wrong.
714 # It only checks for convert-to-bold-on-single-character-word when the word
715 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
716 # This means that the bold token in position 2 (0-indexed) gets converted by
717 # parsoid, but doesn't get changed by the PHP parser.
718 !! test
719 Italics and bold: other quote tests: (3,2,3,3) (php)
720 !! options
721 php
722 !! input
723 '''this is about ''foo'''s family'''
724 !! result
725 <p>'<i>this is about </i>foo<b>s family</b>
726 </p>
727 !!end
728 # This is the output the Parsoid team believes to be correct.
729 !! test
730 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
731 !! options
732 parsoid
733 !! input
734 '''this is about ''foo'''s family'''
735 !! result
736 <p><b>this is about <i>foo'</i>s family</b>
737 </p>
738 !!end
739
740
741 !! test
742 Italics and bold: other quote tests: (3,(2,2),3)
743 !! input
744 '''this is about ''foo's'' family'''
745 !! result
746 <p><b>this is about <i>foo's</i> family</b>
747 </p>
748 !!end
749
750
751 !! test
752 Italicized possessive
753 !! input
754 The ''[[Main Page]]'''s talk page.
755 !! result
756 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
757 </p>
758 !! end
759
760 ###
761 ### Non-html5 tags
762 ###
763
764 !! test
765 Non-html5 tags should be accepted
766 !! input
767 <center>''foo''</center>
768 <big>''foo''</big>
769 <font>''foo''</font>
770 <strike>''foo''</strike>
771 <tt>''foo''</tt>
772 !! result
773 <center><i>foo</i></center>
774 <p><big><i>foo</i></big>
775 <font><i>foo</i></font>
776 <strike><i>foo</i></strike>
777 <tt><i>foo</i></tt>
778 </p>
779 !! end
780
781 ###
782 ### <nowiki> test cases
783 ###
784
785 !! test
786 <nowiki> unordered list
787 !! input
788 <nowiki>* This is not an unordered list item.</nowiki>
789 !! result
790 <p>* This is not an unordered list item.
791 </p>
792 !! end
793
794 !! test
795 <nowiki> spacing
796 !! input
797 <nowiki>Lorem ipsum dolor
798
799 sed abit.
800 sed nullum.
801
802 :and a colon
803 </nowiki>
804 !! result
805 <p>Lorem ipsum dolor
806
807 sed abit.
808 sed nullum.
809
810 :and a colon
811
812 </p>
813 !! end
814
815 !! test
816 nowiki 3
817 !! input
818 :There is not nowiki.
819 :There is <nowiki>nowiki</nowiki>.
820
821 #There is not nowiki.
822 #There is <nowiki>nowiki</nowiki>.
823
824 *There is not nowiki.
825 *There is <nowiki>nowiki</nowiki>.
826 !! result
827 <dl><dd>There is not nowiki.
828 </dd><dd>There is nowiki.
829 </dd></dl>
830 <ol><li>There is not nowiki.
831 </li><li>There is nowiki.
832 </li></ol>
833 <ul><li>There is not nowiki.
834 </li><li>There is nowiki.
835 </li></ul>
836
837 !! end
838
839 !! test
840 Entities inside <nowiki>
841 !! input
842 <nowiki>&lt;</nowiki>
843 !! result
844 <p>&lt;
845 </p>
846 !! end
847
848
849 ###
850 ### Comments
851 ###
852 !! test
853 Comments and Indent-Pre
854 !! input
855 <!-- comment 1 --> asdf
856
857 <!-- comment 1 --> asdf
858 <!-- comment 2 -->
859
860 <!-- comment 1 --> asdf
861 <!-- comment 2 -->xyz
862
863 <!-- comment 1 --> asdf
864 <!-- comment 2 --> xyz
865 !! result
866 <pre>asdf
867 </pre>
868 <pre>asdf
869 </pre>
870 <pre>asdf
871 </pre>
872 <p>xyz
873 </p>
874 <pre>asdf
875 xyz
876 </pre>
877 !! end
878
879 !! test
880 Comment test 2a
881 !! input
882 asdf
883 <!-- comment 1 -->
884 jkl
885 !! result
886 <p>asdf
887 jkl
888 </p>
889 !! end
890
891 !! test
892 Comment test 2b
893 !! input
894 asdf
895 <!-- comment 1 -->
896
897 jkl
898 !! result
899 <p>asdf
900 </p><p>jkl
901 </p>
902 !! end
903
904 !! test
905 Comment test 3
906 !! input
907 asdf
908 <!-- comment 1 -->
909 <!-- comment 2 -->
910 jkl
911 !! result
912 <p>asdf
913 jkl
914 </p>
915 !! end
916
917 !! test
918 Comment test 4
919 !! input
920 asdf<!-- comment 1 -->jkl
921 !! result
922 <p>asdfjkl
923 </p>
924 !! end
925
926 !! test
927 Comment spacing
928 !! input
929 a
930 <!-- foo --> b <!-- bar -->
931 c
932 !! result
933 <p>a
934 </p>
935 <pre> b
936 </pre>
937 <p>c
938 </p>
939 !! end
940
941 !! test
942 Comment whitespace
943 !! input
944 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
945 !! result
946
947 !! end
948
949 !! test
950 Comment semantics and delimiters
951 !! input
952 <!-- --><!----><!-----><!------>
953 !! result
954
955 !! end
956
957 !! test
958 Comment semantics and delimiters, redux
959 !! input
960 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
961 -- foo -- funky huh? ... -->
962 !! result
963
964 !! end
965
966 !! test
967 Comment semantics and delimiters: directors cut
968 !! input
969 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
970 everything starting with < followed by !-- until the first -- and > we see,
971 that wouldn't be valid XML however, since in XML -- has to terminate a comment
972 -->-->
973 !! result
974 <p>--&gt;
975 </p>
976 !! end
977
978 !! test
979 Comment semantics: nesting
980 !! input
981 <!--<!-- no, we're not going to do anything fancy here -->-->
982 !! result
983 <p>--&gt;
984 </p>
985 !! end
986
987 !! test
988 Comment semantics: unclosed comment at end
989 !! input
990 <!--This comment will run out to the end of the document
991 !! result
992
993 !! end
994
995 !! test
996 Comment in template title
997 !! input
998 {{f<!---->oo}}
999 !! result
1000 <p>FOO
1001 </p>
1002 !! end
1003
1004 !! test
1005 Comment on its own line post-expand
1006 !! input
1007 a
1008 {{blank}}<!---->
1009 b
1010 !! result
1011 <p>a
1012 </p><p>b
1013 </p>
1014 !! end
1015
1016 !! test
1017 Comment on its own line post-expand with non-significant whitespace
1018 !! input
1019 a
1020 {{blank}} <!---->
1021 b
1022 !! result
1023 <p>a
1024 </p><p>b
1025 </p>
1026 !! end
1027
1028 ###
1029 ### paragraph wraping tests
1030 ###
1031 !! test
1032 No block tags
1033 !! input
1034 a
1035
1036 b
1037 !! result
1038 <p>a
1039 </p><p>b
1040 </p>
1041 !! end
1042 !! test
1043 Block tag on one line
1044 !! input
1045 a <div>foo</div>
1046
1047 b
1048 !! result
1049 a <div>foo</div>
1050 <p>b
1051 </p>
1052 !! end
1053
1054 !! test
1055 Block tag on both lines
1056 !! input
1057 a <div>foo</div>
1058
1059 b <div>foo</div>
1060 !! result
1061 a <div>foo</div>
1062 b <div>foo</div>
1063
1064 !! end
1065
1066 !! test
1067 Multiple lines without block tags
1068 !! input
1069 <div>foo</div> a
1070 b
1071 c
1072 d<!--foo--> e
1073 x <div>foo</div> z
1074 !! result
1075 <div>foo</div> a
1076 <p>b
1077 c
1078 d e
1079 </p>
1080 x <div>foo</div> z
1081
1082 !! end
1083
1084 !! test
1085 Empty lines between lines with block tags
1086 !! input
1087 <div></div>
1088
1089
1090 <div></div>a
1091
1092 b
1093 <div>a</div>b
1094
1095 <div>b</div>d
1096
1097
1098 <div>e</div>
1099 !! result
1100 <div></div>
1101 <p><br />
1102 </p>
1103 <div></div>a
1104 <p>b
1105 </p>
1106 <div>a</div>b
1107 <div>b</div>d
1108 <p><br />
1109 </p>
1110 <div>e</div>
1111
1112 !! end
1113
1114 ###
1115 ### Preformatted text
1116 ###
1117 !! test
1118 Preformatted text
1119 !! input
1120 This is some
1121 Preformatted text
1122 With ''italic''
1123 And '''bold'''
1124 And a [[Main Page|link]]
1125 !! result
1126 <pre>This is some
1127 Preformatted text
1128 With <i>italic</i>
1129 And <b>bold</b>
1130 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1131 </pre>
1132 !! end
1133
1134 !! test
1135 Ident preformatting with inline content
1136 !! input
1137 a
1138 ''b''
1139 !! result
1140 <pre>a
1141 <i>b</i>
1142 </pre>
1143 !! end
1144
1145 !! test
1146 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1147 !! input
1148 <pre><nowiki>
1149 <b>
1150 <cite>
1151 <em>
1152 </nowiki></pre>
1153 !! result
1154 <pre>
1155 &lt;b&gt;
1156 &lt;cite&gt;
1157 &lt;em&gt;
1158 </pre>
1159
1160 !! end
1161
1162 !! test
1163 Regression with preformatted in <center>
1164 !! input
1165 <center>
1166 Blah
1167 </center>
1168 !! result
1169 <center>
1170 <pre>Blah
1171 </pre>
1172 </center>
1173
1174 !! end
1175
1176 # Expected output in the following test is not really expected (there should be
1177 # <pre> in the output) -- it's only testing for well-formedness.
1178 !! test
1179 Bug 6200: Preformatted in <blockquote>
1180 !! input
1181 <blockquote>
1182 Blah
1183 </blockquote>
1184 !! result
1185 <blockquote>
1186 Blah
1187 </blockquote>
1188
1189 !! end
1190
1191 !! test
1192 <pre> with attributes (bug 3202)
1193 !! input
1194 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1195 !! result
1196 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1197
1198 !! end
1199
1200 !! test
1201 <pre> with width attribute (bug 3202)
1202 !! input
1203 <pre width="8">Narrow screen goodies</pre>
1204 !! result
1205 <pre width="8">Narrow screen goodies</pre>
1206
1207 !! end
1208
1209 !! test
1210 <pre> with forbidden attribute (bug 3202)
1211 !! input
1212 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1213 !! result
1214 <pre width="8">Narrow screen goodies</pre>
1215
1216 !! end
1217
1218 !! test
1219 Entities inside <pre>
1220 !! input
1221 <pre>&lt;</pre>
1222 !! result
1223 <pre>&lt;</pre>
1224
1225 !! end
1226
1227 !! test
1228 <pre> with forbidden attribute values (bug 3202)
1229 !! input
1230 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1231 !! result
1232 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1233
1234 !! end
1235
1236 !! test
1237 <nowiki> inside <pre> (bug 13238)
1238 !! input
1239 <pre>
1240 <nowiki>
1241 </pre>
1242 <pre>
1243 <nowiki></nowiki>
1244 </pre>
1245 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1246 !! result
1247 <pre>
1248 &lt;nowiki&gt;
1249 </pre>
1250 <pre>
1251
1252 </pre>
1253 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1254
1255 !! end
1256
1257 !! test
1258 <nowiki> and <pre> preference (first one wins)
1259 !! input
1260 <pre>
1261 <nowiki>
1262 </pre>
1263 </nowiki>
1264 </pre>
1265
1266 <nowiki>
1267 <pre>
1268 <nowiki>
1269 </pre>
1270 </nowiki>
1271 </pre>
1272
1273 !! result
1274 <pre>
1275 &lt;nowiki&gt;
1276 </pre>
1277 <p>&lt;/nowiki&gt;
1278 &lt;/pre&gt;
1279 </p><p>
1280 &lt;pre&gt;
1281 &lt;nowiki&gt;
1282 &lt;/pre&gt;
1283
1284 &lt;/pre&gt;
1285 </p>
1286 !! end
1287
1288 !! test
1289 </pre> inside nowiki
1290 !! input
1291 <nowiki></pre></nowiki>
1292 !! result
1293 <p>&lt;/pre&gt;
1294 </p>
1295 !! end
1296
1297 !!test
1298 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1299 !!input
1300 {{echo|}}
1301 !!result
1302
1303 !!end
1304
1305 !!test
1306 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1307 !!input
1308 {{echo|
1309 foo}}
1310 !!result
1311 <p>foo
1312 </p>
1313 !!end
1314
1315 !! test
1316 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1317 !! input
1318 {{echo|a
1319 b}}
1320 !!result
1321 <pre>a
1322 </pre>
1323 <p>b
1324 </p>
1325 !!end
1326
1327 !! test
1328 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1329 !! input
1330 {{echo|a
1331 b
1332 c
1333 d
1334 e
1335 }}
1336 !!result
1337 <pre>a
1338 </pre>
1339 <p>b
1340 c
1341 </p>
1342 <pre>d
1343 </pre>
1344 <p>e
1345 </p>
1346 !!end
1347
1348 !!test
1349 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1350 !!input
1351 {{echo| foo}}
1352
1353 {{echo| foo}}{{echo| bar}}
1354
1355 {{echo| foo}}
1356 {{echo| bar}}
1357
1358 {{echo|<!--cmt--> foo}}
1359
1360 <!--cmt-->{{echo| foo}}
1361
1362 {{echo|{{echo| }}bar}}
1363 !!result
1364 <pre>foo
1365 </pre>
1366 <pre>foo bar
1367 </pre>
1368 <pre>foo
1369 bar
1370 </pre>
1371 <pre>foo
1372 </pre>
1373 <pre>foo
1374 </pre>
1375 <pre>bar
1376 </pre>
1377 !!end
1378
1379 !! test
1380 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1381 !! input
1382 {{echo| }}a
1383
1384 {{echo|
1385 }}a
1386
1387 {{echo|
1388 b}}
1389
1390 {{echo|a
1391 }}b
1392
1393 {{echo|a
1394 }} b
1395 !!result
1396 <pre>a
1397 </pre>
1398 <p><br />
1399 </p>
1400 <pre>a
1401 </pre>
1402 <p><br />
1403 </p>
1404 <pre>b
1405 </pre>
1406 <p>a
1407 </p>
1408 <pre>b
1409 </pre>
1410 <p>a
1411 </p>
1412 <pre>b
1413 </pre>
1414 !!end
1415
1416 !! test
1417 Templates: Single-line variant of parameter whitespace stripping test
1418 !! input
1419 {{echo| a}}
1420
1421 {{echo|1= a}}
1422
1423 {{echo|{{echo| a}}}}
1424
1425 {{echo|1={{echo| a}}}}
1426 !! result
1427 <pre>a
1428 </pre>
1429 <p>a
1430 </p>
1431 <pre>a
1432 </pre>
1433 <p>a
1434 </p>
1435 !! end
1436
1437 !! test
1438 Templates: Strip whitespace from named parameters, but not positional ones
1439 !! input
1440 {{echo|
1441 foo}}
1442
1443 {{echo|
1444 * foo}}
1445
1446 {{echo| 1 =
1447 foo}}
1448
1449 {{echo| 1 =
1450 * foo}}
1451 !! result
1452 <pre>foo
1453 </pre>
1454 <p><br />
1455 </p>
1456 <ul><li> foo
1457 </li></ul>
1458 <p>foo
1459 </p>
1460 <ul><li> foo
1461 </li></ul>
1462
1463 !! end
1464
1465 ###
1466 ### Parsoid-centric tests for testing RT edge cases for pre
1467 ###
1468
1469 !!test
1470 1a. Indent-Pre and Comments
1471 !!input
1472 a
1473 <!--a-->
1474 c
1475 !!result
1476 <pre>a
1477 </pre>
1478 <p>c
1479 </p>
1480 !!end
1481
1482 !!test
1483 1b. Indent-Pre and Comments
1484 !!input
1485 a
1486 <!--a-->
1487 c
1488 !!result
1489 <pre>a
1490 </pre>
1491 <p>c
1492 </p>
1493 !!end
1494
1495 !!test
1496 1c. Indent-Pre and Comments
1497 !!input
1498 <!--a--> a
1499
1500 <!--a--> a
1501 !!result
1502 <pre> a
1503 </pre>
1504 <pre> a
1505 </pre>
1506 !!end
1507
1508 !!test
1509 2a. Indent-Pre and tables
1510 !!input
1511 {|
1512 |-
1513 !h1!!h2
1514 |foo||bar
1515 |}
1516 !!result
1517 <table>
1518
1519 <tr>
1520 <th>h1</th>
1521 <th>h2
1522 </th>
1523 <td>foo</td>
1524 <td>bar
1525 </td></tr></table>
1526
1527 !!end
1528
1529 !!test
1530 2b. Indent-Pre and tables
1531 !!input
1532 {|
1533 |-
1534 |foo
1535 |}
1536 !!result
1537 <table>
1538
1539 <tr>
1540 <td>foo
1541 </td></tr></table>
1542
1543 !!end
1544
1545 !!test
1546 2c. Indent-Pre and tables (bug 42252)
1547 !!input
1548 {|
1549 |+ foo
1550 ! | bar
1551 |}
1552 !!result
1553 <table>
1554 <caption> foo
1555 </caption>
1556 <tr>
1557 <th> bar
1558 </th></tr></table>
1559
1560 !!end
1561
1562 !!test
1563 3a. Indent-Pre and block tags (single-line html)
1564 !!input
1565 <p> foo </p>
1566 <div> foo </div>
1567 <span> foo </span>
1568 !!result
1569 <p> foo </p>
1570 <div> foo </div>
1571 <pre><span> foo </span>
1572 </pre>
1573 !!end
1574
1575 !!test
1576 3b. Indent-Pre and block tags (pre-content on separate line)
1577 !!input
1578 <p>
1579 foo
1580 </p>
1581
1582 <div>
1583 foo
1584 </div>
1585
1586 <center>
1587 foo
1588 </center>
1589
1590 <blockquote>
1591 foo
1592 </blockquote>
1593
1594 <table><tr><td>
1595 foo
1596 </td></tr></table>
1597
1598 <ul><li>
1599 foo
1600 </li></ul>
1601
1602 !!result
1603 <p>
1604 foo
1605 </p>
1606 <div>
1607 <pre>foo
1608 </pre>
1609 </div>
1610 <center>
1611 <pre>foo
1612 </pre>
1613 </center>
1614 <blockquote>
1615 foo
1616 </blockquote>
1617 <table><tr><td>
1618 <pre>foo
1619 </pre>
1620 </td></tr></table>
1621 <ul><li>
1622 foo
1623 </li></ul>
1624
1625 !!end
1626
1627 !!test
1628 4. Multiple spaces at start-of-line
1629 !!input
1630 <p> foo </p>
1631 foo
1632 {|
1633 |foo
1634 |}
1635 !!result
1636 <p> foo </p>
1637 <pre> foo
1638 </pre>
1639 <table>
1640 <tr>
1641 <td>foo
1642 </td></tr></table>
1643
1644 !!end
1645
1646 !! test
1647 5. White-space in indent-pre
1648 NOTE: the white-space char on 2nd line is significant
1649 !! input
1650 a<br/>
1651
1652 b
1653 !! result
1654 <pre>a<br />
1655
1656 b
1657 </pre>
1658 !! end
1659
1660 ###
1661 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1662 ###
1663
1664 !!test
1665 HTML-pre: 1. embedded newlines
1666 !!input
1667 <pre>foo</pre>
1668
1669 <pre>
1670 foo
1671 </pre>
1672
1673 <pre>
1674
1675 foo
1676 </pre>
1677
1678 <pre>
1679
1680
1681 foo
1682 </pre>
1683 !!result
1684 <pre>foo</pre>
1685 <pre>
1686 foo
1687 </pre>
1688 <pre>
1689
1690 foo
1691 </pre>
1692 <pre>
1693
1694
1695 foo
1696 </pre>
1697
1698 !!end
1699
1700 !!test
1701 HTML-pre: 2: indented text
1702 !!input
1703 <pre>
1704 foo
1705 </pre>
1706 !!result
1707 <pre>
1708 foo
1709 </pre>
1710
1711 !!end
1712
1713 !!test
1714 HTML-pre: 3: other wikitext
1715 !!input
1716 <pre>
1717 * foo
1718 # bar
1719 = no-h =
1720 '' no-italic ''
1721 [[ NoLink ]]
1722 </pre>
1723 !!result
1724 <pre>
1725 * foo
1726 # bar
1727 = no-h =
1728 '' no-italic ''
1729 [[ NoLink ]]
1730 </pre>
1731
1732 !!end
1733
1734 ###
1735 ### Definition lists
1736 ###
1737 !! test
1738 Simple definition
1739 !! input
1740 ; name : Definition
1741 !! result
1742 <dl><dt> name&#160;</dt><dd> Definition
1743 </dd></dl>
1744
1745 !! end
1746
1747 !! test
1748 Definition list for indentation only
1749 !! input
1750 : Indented text
1751 !! result
1752 <dl><dd> Indented text
1753 </dd></dl>
1754
1755 !! end
1756
1757 !! test
1758 Definition list with no space
1759 !! input
1760 ;name:Definition
1761 !! result
1762 <dl><dt>name</dt><dd>Definition
1763 </dd></dl>
1764
1765 !!end
1766
1767 !! test
1768 Definition list with URL link
1769 !! input
1770 ; http://example.com/ : definition
1771 !! result
1772 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1773 </dd></dl>
1774
1775 !! end
1776
1777 !! test
1778 Definition list with bracketed URL link
1779 !! input
1780 ;[http://www.example.com/ Example]:Something about it
1781 !! result
1782 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1783 </dd></dl>
1784
1785 !! end
1786
1787 !! test
1788 Definition list with wikilink containing colon
1789 !! input
1790 ; [[Help:FAQ]]: The least-read page on Wikipedia
1791 !! result
1792 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
1793 </dd></dl>
1794
1795 !! end
1796
1797 # At Brion's and JeLuF's insistence... :)
1798 !! test
1799 Definition list with news link containing colon
1800 !! input
1801 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1802 !! result
1803 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
1804 </dd></dl>
1805
1806 !! end
1807
1808 !! test
1809 Malformed definition list with colon
1810 !! input
1811 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1812 !! result
1813 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
1814 </dt></dl>
1815
1816 !! end
1817
1818 !! test
1819 Definition lists: colon in external link text
1820 !! input
1821 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1822 !! result
1823 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
1824 </dd></dl>
1825
1826 !! end
1827
1828 !! test
1829 Definition lists: colon in HTML attribute
1830 !! input
1831 ;<b style="display: inline">bold</b>
1832 !! result
1833 <dl><dt><b style="display: inline">bold</b>
1834 </dt></dl>
1835
1836 !! end
1837
1838 !! test
1839 Definition lists: self-closed tag
1840 !! input
1841 ;one<br/>two : two-line fun
1842 !! result
1843 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1844 </dd></dl>
1845
1846 !! end
1847
1848 !! test
1849 Bug 11748: Literal closing tags
1850 !! input
1851 <dl>
1852 <dt>test 1</dt>
1853 <dd>test test test test test</dd>
1854 <dt>test 2</dt>
1855 <dd>test test test test test</dd>
1856 </dl>
1857 !! result
1858 <dl>
1859 <dt>test 1</dt>
1860 <dd>test test test test test</dd>
1861 <dt>test 2</dt>
1862 <dd>test test test test test</dd>
1863 </dl>
1864
1865 !! end
1866
1867 !! test
1868 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1869 !! input
1870 <ul><li>
1871 ; term : description
1872 * unordered
1873 </li>
1874 </ul>
1875 !! result
1876 <ul><li>
1877 <dl><dt> term&#160;</dt><dd> description
1878 </dd></dl>
1879 <ul><li> unordered
1880 </li></ul>
1881 </li>
1882 </ul>
1883
1884 !! end
1885
1886 !! test
1887
1888 Definition list with empty definition and following paragraph
1889 !! input
1890 ; term:
1891 Paragraph text
1892 !! result
1893 <dl><dt> term</dt><dd>
1894 </dd></dl>
1895 <p>Paragraph text
1896 </p>
1897 !! end
1898
1899 !! test
1900 Nested definition lists using html syntax
1901 !! input
1902 <dl><dd>
1903 <dl>
1904 <dd>Foo</dd>
1905 </dl>
1906 </dd></dl>
1907 !! result
1908 <dl><dd>
1909 <dl>
1910 <dd>Foo</dd>
1911 </dl>
1912 </dd></dl>
1913
1914 !! end
1915
1916 !! test
1917 Definition Lists: No nesting: Multiple dd's
1918 !! input
1919 ;x
1920 :a
1921 :b
1922 !! result
1923 <dl><dt>x
1924 </dt><dd>a
1925 </dd><dd>b
1926 </dd></dl>
1927
1928 !! end
1929
1930 !! test
1931 Definition Lists: Indentation: Regular
1932 !! input
1933 :i1
1934 ::i2
1935 :::i3
1936 !! result
1937 <dl><dd>i1
1938 <dl><dd>i2
1939 <dl><dd>i3
1940 </dd></dl>
1941 </dd></dl>
1942 </dd></dl>
1943
1944 !! end
1945
1946 !! test
1947 Definition Lists: Indentation: Missing 1st level
1948 !! input
1949 ::i2
1950 :::i3
1951 !! result
1952 <dl><dd><dl><dd>i2
1953 <dl><dd>i3
1954 </dd></dl>
1955 </dd></dl>
1956 </dd></dl>
1957
1958 !! end
1959
1960 !! test
1961 Definition Lists: Indentation: Multi-level indent
1962 !! input
1963 :::i3
1964 !! result
1965 <dl><dd><dl><dd><dl><dd>i3
1966 </dd></dl>
1967 </dd></dl>
1968 </dd></dl>
1969
1970 !! end
1971
1972 !! test
1973 Definition Lists: Hacky use to indent tables
1974 !! input
1975 ::{|
1976 |foo
1977 |bar
1978 |}
1979 this text
1980 should be left alone
1981 !! result
1982 <dl><dd><dl><dd><table>
1983 <tr>
1984 <td>foo
1985 </td>
1986 <td>bar
1987 </td></tr></table></dd></dl></dd></dl>
1988 <p>this text
1989 should be left alone
1990 </p>
1991 !! end
1992 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1993 ## as an empty dt item. It also ignores all but the last ";" when followed
1994 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1995 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1996 ## ";"s.
1997 ##
1998 ## Ex: ";;t2 ::d2" is transformed into:
1999 ##
2000 ## <dl>
2001 ## <dt>t2 </dt>
2002 ## <dd>
2003 ## <dl>
2004 ## <dt></dt>
2005 ## <dd>d2</dd>
2006 ## </dl>
2007 ## </dd>
2008 ## </dl>
2009 ##
2010 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2011 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2012 ##
2013 ## <dl>
2014 ## <dt>
2015 ## <dl>
2016 ## <dt>t2 </dt>
2017 ## <dd>:d2</dd>
2018 ## </dl>
2019 ## </dt>
2020 ## </dl>
2021 ##
2022 ## All Parsoid only definition list tests have this difference.
2023 ##
2024 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2025 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2026
2027 !! test
2028 Table / list interaction: indented table with lists in table contents
2029 !! input
2030 :{|
2031 |-
2032 | a
2033 * b
2034 |-
2035 | c
2036 * d
2037 |}
2038 !! result
2039 <dl><dd><table>
2040
2041 <tr>
2042 <td> a
2043 <ul><li> b
2044 </li></ul>
2045 </td></tr>
2046 <tr>
2047 <td> c
2048 <ul><li> d
2049 </li></ul>
2050 </td></tr></table></dd></dl>
2051
2052 !! end
2053
2054 !!test
2055 Table / list interaction: lists nested in tables nested in indented lists
2056 !!input
2057 :{|
2058 |
2059 :a
2060 :b
2061 |
2062 *c
2063 *d
2064 |}
2065
2066 *e
2067 *f
2068 !!result
2069 <dl><dd><table>
2070 <tr>
2071 <td>
2072 <dl><dd>a
2073 </dd><dd>b
2074 </dd></dl>
2075 </td>
2076 <td>
2077 <ul><li>c
2078 </li><li>d
2079 </li></ul>
2080 </td></tr></table></dd></dl>
2081 <ul><li>e
2082 </li><li>f
2083 </li></ul>
2084
2085 !!end
2086
2087 !! test
2088 Definition Lists: Nesting: Multi-level (Parsoid only)
2089 !! options
2090 parsoid
2091 !! input
2092 ;t1 :d1
2093 ;;t2 ::d2
2094 ;;;t3 :::d3
2095 !! result
2096 <dl>
2097 <dt>t1 </dt>
2098 <dd>d1</dd>
2099 <dt>
2100 <dl>
2101 <dt>t2 </dt>
2102 <dd>:d2</dd>
2103 <dt>
2104 <dl>
2105 <dt>t3 </dt>
2106 <dd>::d3</dd>
2107 </dl>
2108 </dt>
2109 </dl>
2110 </dt>
2111 </dl>
2112
2113
2114 !! end
2115
2116
2117 !! test
2118 Definition Lists: Nesting: Test 2 (Parsoid only)
2119 !! options
2120 parsoid
2121 !! input
2122 ;t1
2123 ::d2
2124 !! result
2125 <dl>
2126 <dt>t1</dt>
2127 <dd>
2128 <dl>
2129 <dd>d2</dd>
2130 </dl>
2131 </dd>
2132 </dl>
2133
2134 !! end
2135
2136
2137 !! test
2138 Definition Lists: Nesting: Test 3 (Parsoid only)
2139 !! options
2140 parsoid
2141 !! input
2142 :;t1
2143 ::::d2
2144 !! result
2145 <dl>
2146 <dd>
2147 <dl>
2148 <dt>t1</dt>
2149 <dd>
2150 <dl>
2151 <dd>
2152 <dl>
2153 <dd>d2</dd>
2154 </dl>
2155 </dd>
2156 </dl>
2157 </dd>
2158 </dl>
2159 </dd>
2160 </dl>
2161
2162 !! end
2163
2164
2165 !! test
2166 Definition Lists: Nesting: Test 4
2167 !! input
2168 ::;t3
2169 :::d3
2170 !! result
2171 <dl><dd><dl><dd><dl><dt>t3
2172 </dt><dd>d3
2173 </dd></dl>
2174 </dd></dl>
2175 </dd></dl>
2176
2177 !! end
2178
2179
2180 ## The Parsoid team believes the following three test exposes a
2181 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2182 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2183 !! test
2184 Definition Lists: Mixed Lists: Test 1 (php)
2185 !! options
2186 php
2187 !! input
2188 :;* foo
2189 ::* bar
2190 :; baz
2191 !! result
2192 <dl><dd><dl><dt><ul><li> foo
2193 </li><li> bar
2194 </li></ul>
2195 </dt></dl>
2196 <dl><dt> baz
2197 </dt></dl>
2198 </dd></dl>
2199
2200 !! end
2201 !! test
2202 Definition Lists: Mixed Lists: Test 1 (parsoid)
2203 !! options
2204 parsoid
2205 !! input
2206 :;* foo
2207 ::* bar
2208 :; baz
2209 !! result
2210 <dl><dd><dl><dt><ul><li> foo
2211 </li></ul></dt><dd><ul><li> bar
2212 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2213 !! end
2214
2215 !! test
2216 Definition Lists: Mixed Lists: Test 2
2217 !! input
2218 *: d1
2219 *: d2
2220 !! result
2221 <ul><li><dl><dd> d1
2222 </dd><dd> d2
2223 </dd></dl>
2224 </li></ul>
2225
2226 !! end
2227
2228
2229 !! test
2230 Definition Lists: Mixed Lists: Test 3
2231 !! input
2232 *::: d1
2233 *::: d2
2234 !! result
2235 <ul><li><dl><dd><dl><dd><dl><dd> d1
2236 </dd><dd> d2
2237 </dd></dl>
2238 </dd></dl>
2239 </dd></dl>
2240 </li></ul>
2241
2242 !! end
2243
2244
2245 !! test
2246 Definition Lists: Mixed Lists: Test 4
2247 !! input
2248 *;d1 :d2
2249 *;d3 :d4
2250 !! result
2251 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2252 </dd><dt>d3&#160;</dt><dd>d4
2253 </dd></dl>
2254 </li></ul>
2255
2256 !! end
2257
2258
2259 !! test
2260 Definition Lists: Mixed Lists: Test 5
2261 !! input
2262 *:d1
2263 *:: d2
2264 !! result
2265 <ul><li><dl><dd>d1
2266 <dl><dd> d2
2267 </dd></dl>
2268 </dd></dl>
2269 </li></ul>
2270
2271 !! end
2272
2273
2274 !! test
2275 Definition Lists: Mixed Lists: Test 6
2276 !! input
2277 #*:d1
2278 #*::: d3
2279 !! result
2280 <ol><li><ul><li><dl><dd>d1
2281 <dl><dd><dl><dd> d3
2282 </dd></dl>
2283 </dd></dl>
2284 </dd></dl>
2285 </li></ul>
2286 </li></ol>
2287
2288 !! end
2289
2290
2291 !! test
2292 Definition Lists: Mixed Lists: Test 7
2293 !! input
2294 :* d1
2295 :* d2
2296 !! result
2297 <dl><dd><ul><li> d1
2298 </li><li> d2
2299 </li></ul>
2300 </dd></dl>
2301
2302 !! end
2303
2304
2305 !! test
2306 Definition Lists: Mixed Lists: Test 8
2307 !! input
2308 :* d1
2309 ::* d2
2310 !! result
2311 <dl><dd><ul><li> d1
2312 </li></ul>
2313 <dl><dd><ul><li> d2
2314 </li></ul>
2315 </dd></dl>
2316 </dd></dl>
2317
2318 !! end
2319
2320
2321 !! test
2322 Definition Lists: Mixed Lists: Test 9
2323 !! input
2324 *;foo :bar
2325 !! result
2326 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2327 </dd></dl>
2328 </li></ul>
2329
2330 !! end
2331
2332
2333 !! test
2334 Definition Lists: Mixed Lists: Test 10
2335 !! input
2336 *#;foo :bar
2337 !! result
2338 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2339 </dd></dl>
2340 </li></ol>
2341 </li></ul>
2342
2343 !! end
2344
2345 # The Parsoid team disagrees with the PHP parser's seemingly-random
2346 # rules regarding dd/dt on the next two tests. Parsoid is more
2347 # consistent, and recognizes the shared nesting and keeps the
2348 # still-open tags around until the nesting is complete.
2349
2350 !! test
2351 Definition Lists: Mixed Lists: Test 11 (php)
2352 !! options
2353 php
2354 !! input
2355 *#*#;*;;foo :bar
2356 *#*#;boo :baz
2357 !! result
2358 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2359 </dt></dl>
2360 </dd></dl>
2361 </li></ul>
2362 </dd></dl>
2363 <dl><dt>boo&#160;</dt><dd>baz
2364 </dd></dl>
2365 </li></ol>
2366 </li></ul>
2367 </li></ol>
2368 </li></ul>
2369
2370 !! end
2371 !! test
2372 Definition Lists: Mixed Lists: Test 11 (parsoid)
2373 !! options
2374 parsoid
2375 !! input
2376 *#*#;*;;foo :bar
2377 *#*#;boo :baz
2378 !! result
2379 <ul>
2380 <li>
2381 <ol>
2382 <li>
2383 <ul>
2384 <li>
2385 <ol>
2386 <li>
2387 <dl>
2388 <dt>
2389 <ul>
2390 <li>
2391 <dl>
2392 <dt>
2393 <dl>
2394 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2395 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2396 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2397 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2398 !! end
2399
2400
2401 !! test
2402 Definition Lists: Weird Ones: Test 1 (php)
2403 !! options
2404 php
2405 !! input
2406 *#;*::;; foo : bar (who uses this?)
2407 !! result
2408 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2409 </dt></dl>
2410 </dd></dl>
2411 </dd></dl>
2412 </dd></dl>
2413 </li></ul>
2414 </dd></dl>
2415 </li></ol>
2416 </li></ul>
2417
2418 !! end
2419 !! test
2420 Definition Lists: Weird Ones: Test 1 (parsoid)
2421 !! options
2422 parsoid
2423 !! input
2424 *#;*::;; foo : bar (who uses this?)
2425 !! result
2426 <ul>
2427 <li>
2428 <ol>
2429 <li>
2430 <dl>
2431 <dt>
2432 <ul>
2433 <li>
2434 <dl>
2435 <dd>
2436 <dl>
2437 <dd>
2438 <dl>
2439 <dt>
2440 <dl>
2441 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2442 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
2443 !! end
2444
2445 ###
2446 ### External links
2447 ###
2448 !! test
2449 External links: non-bracketed
2450 !! input
2451 Non-bracketed: http://example.com
2452 !! result
2453 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2454 </p>
2455 !! end
2456
2457 !! test
2458 External links: numbered
2459 !! input
2460 Numbered: [http://example.com]
2461 Numbered: [http://example.net]
2462 Numbered: [http://example.com]
2463 !! result
2464 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2465 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2466 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2467 </p>
2468 !!end
2469
2470 !! test
2471 External links: specified text
2472 !! input
2473 Specified text: [http://example.com link]
2474 !! result
2475 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2476 </p>
2477 !!end
2478
2479 !! test
2480 External links: trail
2481 !! input
2482 Linktrails should not work for external links: [http://example.com link]s
2483 !! result
2484 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2485 </p>
2486 !! end
2487
2488 !! test
2489 External links: dollar sign in URL
2490 !! input
2491 http://example.com/1$2345
2492 !! result
2493 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2494 </p>
2495 !! end
2496
2497 !! test
2498 External links: dollar sign in URL (named)
2499 !! input
2500 [http://example.com/1$2345]
2501 !! result
2502 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2503 </p>
2504 !!end
2505
2506 !! test
2507 External links: open square bracket forbidden in URL (bug 4377)
2508 !! input
2509 http://example.com/1[2345
2510 !! result
2511 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2512 </p>
2513 !! end
2514
2515 !! test
2516 External links: open square bracket forbidden in URL (named) (bug 4377)
2517 !! input
2518 [http://example.com/1[2345]
2519 !! result
2520 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2521 </p>
2522 !!end
2523
2524 !! test
2525 External links: nowiki in URL link text (bug 6230)
2526 !!input
2527 [http://example.com/ <nowiki>''example site''</nowiki>]
2528 !! result
2529 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2530 </p>
2531 !! end
2532
2533 !! test
2534 External links: newline forbidden in text (bug 6230 regression check)
2535 !! input
2536 [http://example.com/ first
2537 second]
2538 !! result
2539 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2540 second]
2541 </p>
2542 !!end
2543
2544 !! test
2545 External links: Pipe char between url and text
2546 !! input
2547 [http://example.com | link]
2548 !! result
2549 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2550 </p>
2551 !!end
2552
2553 !! test
2554 External links: protocol-relative URL in brackets
2555 !! input
2556 [//example.com/ Test]
2557 !! result
2558 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2559 </p>
2560 !! end
2561
2562 !! test
2563 External links: protocol-relative URL in brackets without text
2564 !! input
2565 [//example.com]
2566 !! result
2567 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2568 </p>
2569 !! end
2570
2571 !! test
2572 External links: protocol-relative URL in free text is left alone
2573 !! input
2574 //example.com/Foo
2575 !! result
2576 <p>//example.com/Foo
2577 </p>
2578 !!end
2579
2580 !! test
2581 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2582 !! input
2583 foo//example.com/Foo
2584 !! result
2585 <p>foo//example.com/Foo
2586 </p>
2587 !! end
2588
2589 !! test
2590 External image
2591 !! input
2592 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2593 !! result
2594 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2595 </p>
2596 !! end
2597
2598 !! test
2599 External image from https
2600 !! input
2601 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2602 !! result
2603 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2604 </p>
2605 !! end
2606
2607 !! test
2608 Link to non-http image, no img tag
2609 !! input
2610 Link to non-http image, no img tag: ftp://example.com/test.jpg
2611 !! result
2612 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
2613 </p>
2614 !! end
2615
2616 !! test
2617 External links: terminating separator
2618 !! input
2619 Terminating separator: http://example.com/thing,
2620 !! result
2621 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2622 </p>
2623 !! end
2624
2625 !! test
2626 External links: intervening separator
2627 !! input
2628 Intervening separator: http://example.com/1,2,3
2629 !! result
2630 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2631 </p>
2632 !! end
2633
2634 !! test
2635 External links: old bug with URL in query
2636 !! input
2637 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2638 !! result
2639 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2640 </p>
2641 !! end
2642
2643 !! test
2644 External links: old URL-in-URL bug, mixed protocols
2645 !! input
2646 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2647 !! result
2648 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2649 </p>
2650 !!end
2651
2652 !! test
2653 External links: URL in text
2654 !! input
2655 URL in text: [http://example.com http://example.com]
2656 !! result
2657 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2658 </p>
2659 !! end
2660
2661 !! test
2662 External links: Clickable images
2663 !! input
2664 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2665 !! result
2666 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
2667 </p>
2668 !!end
2669
2670 !! test
2671 External links: raw ampersand
2672 !! input
2673 Old &amp; use: http://x&y
2674 !! result
2675 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2676 </p>
2677 !! end
2678
2679 !! test
2680 External links: encoded ampersand
2681 !! input
2682 Old &amp; use: http://x&amp;y
2683 !! result
2684 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2685 </p>
2686 !! end
2687
2688 !! test
2689 External links: encoded equals (bug 6102)
2690 !! input
2691 http://example.com/?foo&#61;bar
2692 !! result
2693 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2694 </p>
2695 !! end
2696
2697 !! test
2698 External links: [raw ampersand]
2699 !! input
2700 Old &amp; use: [http://x&y]
2701 !! result
2702 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2703 </p>
2704 !! end
2705
2706 !! test
2707 External links: [encoded ampersand]
2708 !! input
2709 Old &amp; use: [http://x&amp;y]
2710 !! result
2711 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2712 </p>
2713 !! end
2714
2715 !! test
2716 External links: [encoded equals] (bug 6102)
2717 !! input
2718 [http://example.com/?foo&#61;bar]
2719 !! result
2720 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2721 </p>
2722 !! end
2723
2724 !! test
2725 External links: [IDN ignored character reference in hostname; strip it right off]
2726 !! input
2727 [http://e&zwnj;xample.com/]
2728 !! result
2729 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2730 </p>
2731 !! end
2732
2733 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2734 # Where an external link could easily circumvent the sanitization of the text of
2735 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2736 # test demands a higher standard. That's a bit strange.
2737 #
2738 # Example:
2739 #
2740 # http://e‌xample.com -> [http://example.com|http://example.com]
2741 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2742 #
2743 # The first example is sanitized, but the second is not. Any security benefits
2744 # from this production are trivial to circumvent. Either remove this test and
2745 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2746 # the test accordingly.
2747 #
2748 # All our love,
2749 # The Parsoid team.
2750 !! test
2751 External links: IDN ignored character reference in hostname; strip it right off
2752 !! input
2753 http://e&zwnj;xample.com/
2754 !! result
2755 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2756 </p>
2757 !! end
2758
2759 !! test
2760 External links: www.jpeg.org (bug 554)
2761 !! input
2762 http://www.jpeg.org
2763 !!result
2764 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2765 </p>
2766 !! end
2767
2768 !! test
2769 External links: URL within URL (original bug 2)
2770 !! input
2771 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2772 !! result
2773 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2774 </p>
2775 !! end
2776
2777 !! test
2778 BUG 361: URL inside bracketed URL
2779 !! input
2780 [http://www.example.com/foo http://www.example.com/bar]
2781 !! result
2782 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2783 </p>
2784 !! end
2785
2786 !! test
2787 BUG 361: URL within URL, not bracketed
2788 !! input
2789 http://www.example.com/foo?=http://www.example.com/bar
2790 !! result
2791 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
2792 </p>
2793 !! end
2794
2795 !! test
2796 BUG 289: ">"-token in URL-tail
2797 !! input
2798 http://www.example.com/<hello>
2799 !! result
2800 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2801 </p>
2802 !!end
2803
2804 !! test
2805 BUG 289: literal ">"-token in URL-tail
2806 !! input
2807 http://www.example.com/<b>html</b>
2808 !! result
2809 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2810 </p>
2811 !!end
2812
2813 !! test
2814 BUG 289: ">"-token in bracketed URL
2815 !! input
2816 [http://www.example.com/<hello> stuff]
2817 !! result
2818 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2819 </p>
2820 !!end
2821
2822 !! test
2823 BUG 289: literal ">"-token in bracketed URL
2824 !! input
2825 [http://www.example.com/<b>html</b> stuff]
2826 !! result
2827 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2828 </p>
2829 !!end
2830
2831 !! test
2832 BUG 289: literal double quote at end of URL
2833 !! input
2834 http://www.example.com/"hello"
2835 !! result
2836 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2837 </p>
2838 !!end
2839
2840 !! test
2841 BUG 289: literal double quote in bracketed URL
2842 !! input
2843 [http://www.example.com/"hello" stuff]
2844 !! result
2845 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2846 </p>
2847 !!end
2848
2849 !! test
2850 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2851 !! input
2852 [http://www.example.com test]
2853 !! result
2854 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2855 </p>
2856 !! end
2857
2858 !! test
2859 External links: link text with spaces
2860 !! input
2861 [http://www.example.com a b c]
2862 [http://www.example.com ''a'' ''b'']
2863 !! result
2864 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2865 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2866 </p>
2867 !! end
2868
2869 !! test
2870 External links: wiki links within external link (Bug 3695)
2871 !! input
2872 [http://example.com [[wikilink]] embedded in ext link]
2873 !! result
2874 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
2875 </p>
2876 !! end
2877
2878 !! test
2879 BUG 787: Links with one slash after the url protocol are invalid
2880 !! input
2881 http:/example.com
2882
2883 [http:/example.com title]
2884 !! result
2885 <p>http:/example.com
2886 </p><p>[http:/example.com title]
2887 </p>
2888 !! end
2889
2890 !! test
2891 Bracketed external links with template-generated invalid target
2892 !! input
2893 [{{echo|http:/example.com}} title]
2894 !! result
2895 <p>[http:/example.com title]
2896 </p>
2897 !! end
2898
2899 !! test
2900 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2901 !! input
2902 ''[http://example.com text'']
2903 [http://example.com '''text]'''
2904 ''Something [http://example.com in italic'']
2905 ''Something [http://example.com mixed''''', even bold]'''
2906 '''''Now [http://example.com both''''']
2907 !! result
2908 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2909 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2910 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2911 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2912 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2913 </p>
2914 !! end
2915
2916
2917 !! test
2918 Bug 4781: %26 in URL
2919 !! input
2920 http://www.example.com/?title=AT%26T
2921 !! result
2922 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2923 </p>
2924 !! end
2925
2926 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2927 # % is actually legal in HTML5. Any change in output would need testing though.
2928 !! test
2929 Bug 4781, 5267: %25 in URL
2930 !! input
2931 http://www.example.com/?title=100%25_Bran
2932 !! result
2933 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
2934 </p>
2935 !! end
2936
2937 !! test
2938 Bug 4781, 5267: %28, %29 in URL
2939 !! input
2940 http://www.example.com/?title=Ben-Hur_%281959_film%29
2941 !! result
2942 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
2943 </p>
2944 !! end
2945
2946
2947 !! test
2948 Bug 4781: %26 in autonumber URL
2949 !! input
2950 [http://www.example.com/?title=AT%26T]
2951 !! result
2952 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2953 </p>
2954 !! end
2955
2956 !! test
2957 Bug 4781, 5267: %26 in autonumber URL
2958 !! input
2959 [http://www.example.com/?title=100%25_Bran]
2960 !! result
2961 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2962 </p>
2963 !! end
2964
2965 !! test
2966 Bug 4781, 5267: %28, %29 in autonumber URL
2967 !! input
2968 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2969 !! result
2970 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2971 </p>
2972 !! end
2973
2974
2975 !! test
2976 Bug 4781: %26 in bracketed URL
2977 !! input
2978 [http://www.example.com/?title=AT%26T link]
2979 !! result
2980 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2981 </p>
2982 !! end
2983
2984 !! test
2985 Bug 4781, 5267: %26 in bracketed URL
2986 !! input
2987 [http://www.example.com/?title=100%25_Bran link]
2988 !! result
2989 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2990 </p>
2991 !! end
2992
2993 !! test
2994 Bug 4781, 5267: %28, %29 in bracketed URL
2995 !! input
2996 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2997 !! result
2998 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2999 </p>
3000 !! end
3001
3002 !! test
3003 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3004 !! input
3005 Some [http://example.com/ pretty ''italics'' and stuff]!
3006 !! result
3007 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3008 </p>
3009 !! end
3010
3011 !! test
3012 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3013 !! input
3014 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3015 !! result
3016 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
3017 </p>
3018 !! end
3019
3020 !! test
3021 External link containing double-single-quotes with no space separating the url from text in italics
3022 !! input
3023 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
3024 !! result
3025 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
3026 </p>
3027 !! end
3028
3029 !! test
3030 URL-encoding in URL functions (single parameter)
3031 !! input
3032 {{localurl:Some page|amp=&}}
3033 !! result
3034 <p>/index.php?title=Some_page&amp;amp=&amp;
3035 </p>
3036 !! end
3037
3038 !! test
3039 URL-encoding in URL functions (multiple parameters)
3040 !! input
3041 {{localurl:Some page|q=?&amp=&}}
3042 !! result
3043 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3044 </p>
3045 !! end
3046
3047 !! test
3048 Brackets in urls
3049 !! input
3050 http://example.com/index.php?foozoid%5B%5D=bar
3051
3052 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3053 !! result
3054 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3055 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3056 </p>
3057 !! end
3058
3059 !! test
3060 IPv6 urls (bug 21261)
3061 !! options
3062 disabled
3063 !! input
3064 http://[2404:130:0:1000::187:2]/index.php
3065 !! result
3066 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
3067 </p>
3068 !! end
3069
3070 !! test
3071 Non-extlinks in brackets
3072 !! input
3073 [foo]
3074 [foo bar]
3075 [foo ''bar'']
3076 [fool's] errand
3077 [fool's errand]
3078 [{{echo|foo}}]
3079 [{{echo|foo}} bar]
3080 [{{echo|foo}} ''bar'']
3081 [{{echo|foo}}l's] errand
3082 [{{echo|foo}}l's errand]
3083 [url={{echo|foo}}]
3084 [url=http://example.com]
3085 !! result
3086 <p>[foo]
3087 [foo bar]
3088 [foo <i>bar</i>]
3089 [fool's] errand
3090 [fool's errand]
3091 [foo]
3092 [foo bar]
3093 [foo <i>bar</i>]
3094 [fool's] errand
3095 [fool's errand]
3096 [url=foo]
3097 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3098 </p>
3099 !! end
3100
3101 ###
3102 ### Quotes
3103 ###
3104
3105 !! test
3106 Quotes
3107 !! input
3108 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3109
3110 Normal text. '''''Bold italic text.''''' Normal text.
3111 !!result
3112 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3113 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3114 </p>
3115 !! end
3116
3117
3118 !! test
3119 Unclosed and unmatched quotes (php)
3120 !! options
3121 php
3122 !! input
3123 '''''Bold italic text '''with bold deactivated''' in between.'''''
3124
3125 '''''Bold italic text ''with italic deactivated'' in between.'''''
3126
3127 '''Bold text..
3128
3129 ..spanning two paragraphs (should not work).'''
3130
3131 '''Bold tag left open
3132
3133 ''Italic tag left open
3134
3135 Normal text.
3136
3137 <!-- Unmatching number of opening, closing tags: -->
3138 '''This year''''s election ''should'' beat '''last year''''s.
3139
3140 ''Tom'''s car is bigger than ''Susan'''s.
3141
3142 Plain ''italic'''s plain
3143 !! result
3144 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3145 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3146 </p><p><b>Bold text..</b>
3147 </p><p>..spanning two paragraphs (should not work).
3148 </p><p><b>Bold tag left open</b>
3149 </p><p><i>Italic tag left open</i>
3150 </p><p>Normal text.
3151 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3152 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3153 </p><p>Plain <i>italic'</i>s plain
3154 </p>
3155 !! end
3156 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3157 # parser strips. The wikitext contains just the first half of the bold
3158 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3159 # differently than the PHP parser.)
3160 !! test
3161 Unclosed and unmatched quotes (parsoid)
3162 !! options
3163 parsoid
3164 !! input
3165 '''''Bold italic text '''with bold deactivated''' in between.'''''
3166
3167 '''''Bold italic text ''with italic deactivated'' in between.'''''
3168
3169 '''Bold text..
3170
3171 ..spanning two paragraphs (should not work).'''
3172
3173 '''Bold tag left open
3174
3175 ''Italic tag left open
3176
3177 Normal text.
3178
3179 <!-- Unmatching number of opening, closing tags: -->
3180 '''This year''''s election ''should'' beat '''last year''''s.
3181
3182 ''Tom'''s car is bigger than ''Susan'''s.
3183
3184 Plain ''italic'''s plain
3185 !! result
3186 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3187 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3188 </p><p><b>Bold text..</b>
3189 </p><p>..spanning two paragraphs (should not work).<b></b>
3190 </p><p><b>Bold tag left open</b>
3191 </p><p><i>Italic tag left open</i>
3192 </p><p>Normal text.
3193 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3194 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3195 </p><p>Plain <i>italic'</i>s plain
3196 </p>
3197 !! end
3198
3199 ###
3200 ### Tables
3201 ###
3202 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3203 ###
3204
3205 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3206 # is the bare minimun required by the spec, see:
3207 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3208 !! test
3209 A table with no data. (php)
3210 !! options
3211 php
3212 !! input
3213 {||}
3214 !! result
3215 !! end
3216 # Parsoid team replies: empty table tags are legal in HTML5
3217 !! test
3218 A table with no data. (parsoid)
3219 !! options
3220 parsoid
3221 !! input
3222 {||}
3223 !! result
3224 <table></table>
3225 !! end
3226
3227 # A table with nothing but a caption is invalid XHTML, we might want to render
3228 # this as <p>caption</p>
3229 !! test
3230 A table with nothing but a caption (php)
3231 !! options
3232 php
3233 !! input
3234 {|
3235 |+ caption
3236 |}
3237 !! result
3238 <table>
3239 <caption> caption
3240 </caption><tr><td></td></tr></table>
3241
3242 !! end
3243 # Parsoid team replies: table with only a caption is legal in HTML5
3244 !! test
3245 A table with nothing but a caption (parsoid)
3246 !! options
3247 parsoid
3248 !! input
3249 {|
3250 |+ caption
3251 |}
3252 !! result
3253 <table><caption> caption</caption></table>
3254 !! end
3255
3256 !! test
3257 A table with caption with default-spaced attributes and a table row
3258 !! input
3259 {|
3260 |+ style="color: red;" | caption1
3261 |-
3262 | foo
3263 |}
3264 !! result
3265 <table>
3266 <caption style="color: red;"> caption1
3267 </caption>
3268 <tr>
3269 <td> foo
3270 </td></tr></table>
3271
3272 !! end
3273
3274 !! test
3275 A table with captions with non-default spaced attributes and a table row
3276 !! input
3277 {|
3278 |+style="color: red;"|caption2
3279 |+ style="color: red;"| caption3
3280 |-
3281 | foo
3282 |}
3283 !! result
3284 <table>
3285 <caption style="color: red;">caption2
3286 </caption>
3287 <caption style="color: red;"> caption3
3288 </caption>
3289 <tr>
3290 <td> foo
3291 </td></tr></table>
3292
3293 !! end
3294
3295 !! test
3296 Table td-cell syntax variations
3297 !! input
3298 {|
3299 | foo bar foo | baz
3300 | foo bar foo || baz
3301 | style='color:red;' | baz
3302 | style='color:red;' || baz
3303 |}
3304 !! result
3305 <table>
3306 <tr>
3307 <td> baz
3308 </td>
3309 <td> foo bar foo </td>
3310 <td> baz
3311 </td>
3312 <td style="color:red;"> baz
3313 </td>
3314 <td> style='color:red;' </td>
3315 <td> baz
3316 </td></tr></table>
3317
3318 !! end
3319
3320 !! test
3321 Simple table
3322 !! input
3323 {|
3324 | 1 || 2
3325 |-
3326 | 3 || 4
3327 |}
3328 !! result
3329 <table>
3330 <tr>
3331 <td> 1 </td>
3332 <td> 2
3333 </td></tr>
3334 <tr>
3335 <td> 3 </td>
3336 <td> 4
3337 </td></tr></table>
3338
3339 !! end
3340
3341 !! test
3342 Simple table but with multiple dashes for row wikitext
3343 !! input
3344 {|
3345 | foo
3346 |-----
3347 | bar
3348 |}
3349 !! result
3350 <table>
3351 <tr>
3352 <td> foo
3353 </td></tr>
3354 <tr>
3355 <td> bar
3356 </td></tr></table>
3357
3358 !! end
3359 !! test
3360 Multiplication table
3361 !! input
3362 {| border="1" cellpadding="2"
3363 |+Multiplication table
3364 |-
3365 ! &times; !! 1 !! 2 !! 3
3366 |-
3367 ! 1
3368 | 1 || 2 || 3
3369 |-
3370 ! 2
3371 | 2 || 4 || 6
3372 |-
3373 ! 3
3374 | 3 || 6 || 9
3375 |-
3376 ! 4
3377 | 4 || 8 || 12
3378 |-
3379 ! 5
3380 | 5 || 10 || 15
3381 |}
3382 !! result
3383 <table border="1" cellpadding="2">
3384 <caption>Multiplication table
3385 </caption>
3386 <tr>
3387 <th> &#215; </th>
3388 <th> 1 </th>
3389 <th> 2 </th>
3390 <th> 3
3391 </th></tr>
3392 <tr>
3393 <th> 1
3394 </th>
3395 <td> 1 </td>
3396 <td> 2 </td>
3397 <td> 3
3398 </td></tr>
3399 <tr>
3400 <th> 2
3401 </th>
3402 <td> 2 </td>
3403 <td> 4 </td>
3404 <td> 6
3405 </td></tr>
3406 <tr>
3407 <th> 3
3408 </th>
3409 <td> 3 </td>
3410 <td> 6 </td>
3411 <td> 9
3412 </td></tr>
3413 <tr>
3414 <th> 4
3415 </th>
3416 <td> 4 </td>
3417 <td> 8 </td>
3418 <td> 12
3419 </td></tr>
3420 <tr>
3421 <th> 5
3422 </th>
3423 <td> 5 </td>
3424 <td> 10 </td>
3425 <td> 15
3426 </td></tr></table>
3427
3428 !! end
3429
3430 !! test
3431 Accept "||" in table headings
3432 !! input
3433 {|
3434 !h1 || h2
3435 |}
3436 !! result
3437 <table>
3438 <tr>
3439 <th>h1 </th>
3440 <th> h2
3441 </th></tr></table>
3442
3443 !! end
3444
3445 !! test
3446 Accept "||" in indented table headings
3447 !! input
3448 :{|
3449 !h1 || h2
3450 |}
3451 !! result
3452 <dl><dd><table>
3453 <tr>
3454 <th>h1 </th>
3455 <th> h2
3456 </th></tr></table></dd></dl>
3457
3458 !! end
3459
3460 !! test
3461 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3462 !! input
3463 {|
3464 !| h1
3465 || a
3466 |}
3467 !! result
3468 <table>
3469 <tr>
3470 <th> h1
3471 </th>
3472 <td> a
3473 </td></tr></table>
3474
3475 !! end
3476
3477 !!test
3478 Accept "| !" at start of line in tables (ignore !-attribute)
3479 !!input
3480 {|
3481 |-
3482 | !style="color:red" | bar
3483 |}
3484 !!result
3485 <table>
3486
3487 <tr>
3488 <td> bar
3489 </td></tr></table>
3490
3491 !!end
3492
3493 !!test
3494 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
3495 !!input
3496 {|
3497 |-
3498 |style='color:red;'|+1
3499 |style='color:blue;'|-1
3500 |-
3501 | 1 || 2 || 3
3502 | 1 ||+2 ||-3
3503 |-
3504 | +1
3505 | -1
3506 |}
3507 !!result
3508 <table>
3509
3510 <tr>
3511 <td style="color:red;">+1
3512 </td>
3513 <td style="color:blue;">-1
3514 </td></tr>
3515 <tr>
3516 <td> 1 </td>
3517 <td> 2 </td>
3518 <td> 3
3519 </td>
3520 <td> 1 </td>
3521 <td>+2 </td>
3522 <td>-3
3523 </td></tr>
3524 <tr>
3525 <td> +1
3526 </td>
3527 <td> -1
3528 </td></tr></table>
3529
3530 !!end
3531
3532 !! test
3533 Table rowspan
3534 !! input
3535 {| border=1
3536 | Cell 1, row 1
3537 |rowspan=2| Cell 2, row 1 (and 2)
3538 | Cell 3, row 1
3539 |-
3540 | Cell 1, row 2
3541 | Cell 3, row 2
3542 |}
3543 !! result
3544 <table border="1">
3545 <tr>
3546 <td> Cell 1, row 1
3547 </td>
3548 <td rowspan="2"> Cell 2, row 1 (and 2)
3549 </td>
3550 <td> Cell 3, row 1
3551 </td></tr>
3552 <tr>
3553 <td> Cell 1, row 2
3554 </td>
3555 <td> Cell 3, row 2
3556 </td></tr></table>
3557
3558 !! end
3559
3560 !! test
3561 Nested table
3562 !! input
3563 {| border=1
3564 | &alpha;
3565 |
3566 {| bgcolor=#ABCDEF border=2
3567 |nested
3568 |-
3569 |table
3570 |}
3571 |the original table again
3572 |}
3573 !! result
3574 <table border="1">
3575 <tr>
3576 <td> &#945;
3577 </td>
3578 <td>
3579 <table bgcolor="#ABCDEF" border="2">
3580 <tr>
3581 <td>nested
3582 </td></tr>
3583 <tr>
3584 <td>table
3585 </td></tr></table>
3586 </td>
3587 <td>the original table again
3588 </td></tr></table>
3589
3590 !! end
3591
3592 !! test
3593 Invalid attributes in table cell (bug 1830)
3594 !! input
3595 {|
3596 |Cell:|broken
3597 |}
3598 !! result
3599 <table>
3600 <tr>
3601 <td>broken
3602 </td></tr></table>
3603
3604 !! end
3605
3606
3607 !! test
3608 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3609 !! input
3610 {|
3611 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3612 !! result
3613 <table>
3614 <tr>
3615 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3616 <td>]" onmouseover="alert(document.cookie)"&gt;test
3617 </td>
3618 </tr>
3619 </table>
3620
3621 !! end
3622
3623
3624 !! test
3625 Indented table markup mixed with indented pre content (proposed in bug 6200)
3626 !! input
3627 <table>
3628 <tr>
3629 <td>
3630 Text that should be rendered preformatted
3631 </td>
3632 </tr>
3633 </table>
3634 !! result
3635 <table>
3636 <tr>
3637 <td>
3638 <pre>Text that should be rendered preformatted
3639 </pre>
3640 </td>
3641 </tr>
3642 </table>
3643
3644 !! end
3645
3646 !! test
3647 Template-generated table cell attributes and cell content
3648 !! input
3649 {|
3650 |{{table_attribs}}
3651 |}
3652 !! result
3653 <table>
3654 <tr>
3655 <td style="color: red"> Foo
3656 </td></tr></table>
3657
3658 !! end
3659
3660 !! test
3661 Table with row followed by newlines and table heading
3662 !! input
3663 {|
3664 |-
3665
3666 ! foo
3667 |}
3668 !! result
3669 <table>
3670
3671
3672 <tr>
3673 <th> foo
3674 </th></tr></table>
3675
3676 !! end
3677
3678 !! test
3679 Table with empty line following the start tag
3680 !! input
3681 {|
3682
3683 |-
3684 | foo
3685 |}
3686 !! result
3687 <table>
3688
3689
3690 <tr>
3691 <td> foo
3692 </td></tr></table>
3693
3694 !! end
3695
3696 # FIXME: Preserve the attribute properly (with an empty string as value) in
3697 # the PHP parser. Parsoid implements the behavior below.
3698 !! test
3699 Table attributes with empty value
3700 !! options
3701 parsoid
3702 !! input
3703 {|
3704 | style=| hello
3705 |}
3706 !! result
3707 <table>
3708 <tbody>
3709 <tr>
3710 <td style=""> hello
3711 </td></tr></tbody></table>
3712
3713 !! end
3714
3715 !! test
3716 Wikitext table with a lot of comments
3717 !! input
3718 {|
3719 <!-- c0 -->
3720 | foo
3721 <!-- c1 -->
3722 |- <!-- c2 -->
3723 <!-- c3 -->
3724 |<!-- c4 -->
3725 <!-- c5 -->
3726 |}
3727 !! result
3728 <table>
3729 <tr>
3730 <td> foo
3731 </td></tr>
3732 <tr>
3733 <td>
3734 </td></tr></table>
3735
3736 !! end
3737
3738 !! test
3739 Wikitext table with double-line table cell
3740 !! input
3741 {|
3742 |a
3743 b
3744 |}
3745 !! result
3746 <table>
3747 <tr>
3748 <td>a
3749 <p>b
3750 </p>
3751 </td></tr></table>
3752
3753 !! end
3754
3755 !! test
3756 Table cell with a single comment
3757 !! input
3758 {|
3759 | <!-- c1 -->
3760 | a
3761 |}
3762 !! result
3763 <table>
3764 <tr>
3765 <td>
3766 </td>
3767 <td> a
3768 </td></tr></table>
3769
3770 !! end
3771
3772 # The expected HTML structure in this test is debatable. The PHP parser does
3773 # not parse this kind of table at all. The main focus for Parsoid is on
3774 # round-tripping, so this output is ok for now. TODO: revisit!
3775 !! test
3776 Wikitext table with html-syntax row (Parsoid)
3777 !! options
3778 parsoid
3779 !! input
3780 {|
3781 |-
3782 <td>foo</td>
3783 |}
3784 !! result
3785 <table>
3786 <tbody>
3787 <tr>
3788 <td>foo</td></tr></tbody></table>
3789 !! end
3790
3791 ###
3792 ### Internal links
3793 ###
3794 !! test
3795 Plain link, capitalized
3796 !! input
3797 [[Main Page]]
3798 !! result
3799 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3800 </p>
3801 !! end
3802
3803 !! test
3804 Plain link, uncapitalized
3805 !! input
3806 [[main Page]]
3807 !! result
3808 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3809 </p>
3810 !! end
3811
3812 !! test
3813 Piped link
3814 !! input
3815 [[Main Page|The Main Page]]
3816 !! result
3817 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3818 </p>
3819 !! end
3820
3821 !! test
3822 Broken link
3823 !! input
3824 [[Zigzagzogzagzig]]
3825 !! result
3826 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3827 </p>
3828 !! end
3829
3830 !! test
3831 Broken link with fragment
3832 !! input
3833 [[Zigzagzogzagzig#zug]]
3834 !! result
3835 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3836 </p>
3837 !! end
3838
3839 !! test
3840 Special page link with fragment
3841 !! input
3842 [[Special:Version#anchor]]
3843 !! result
3844 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3845 </p>
3846 !! end
3847
3848 !! test
3849 Nonexistent special page link with fragment
3850 !! input
3851 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3852 !! result
3853 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3854 </p>
3855 !! end
3856
3857 !! test
3858 Link with prefix
3859 !! input
3860 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3861 !! result
3862 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3863 </p>
3864 !! end
3865
3866 !! test
3867 Link with suffix
3868 !! input
3869 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3870 !! result
3871 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
3872 </p>
3873 !! end
3874
3875 !! article
3876 prefixed article
3877 !! text
3878 Some text
3879 !! endarticle
3880
3881 !! test
3882 Bug 43661: Piped links with identical prefixes
3883 !! input
3884 [[prefixed article|prefixed articles with spaces]]
3885
3886 [[prefixed article|prefixed articlesaoeu]]
3887
3888 [[Main Page|Main Page test]]
3889 !! result
3890 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3891 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3892 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3893 </p>
3894 !! end
3895
3896
3897 !! test
3898 Link with HTML entity in suffix / tail
3899 !! input
3900 [[Main Page]]&quot;, [[Main Page]]&#97;
3901 !! result
3902 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
3903 </p>
3904 !! end
3905
3906 !! test
3907 Link with 3 brackets
3908 !! input
3909 [[[main page]]]
3910 !! result
3911 <p>[[[main page]]]
3912 </p>
3913 !! end
3914
3915 !! test
3916 Piped link with 3 brackets
3917 !! input
3918 [[[main page|the main page]]]
3919 !! result
3920 <p>[[[main page|the main page]]]
3921 </p>
3922 !! end
3923
3924 !! test
3925 Link with multiple pipes
3926 !! input
3927 [[Main Page|The|Main|Page]]
3928 !! result
3929 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3930 </p>
3931 !! end
3932
3933 !! test
3934 Link to namespaces
3935 !! input
3936 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3937 !! result
3938 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
3939 </p>
3940 !! end
3941
3942 !! test
3943 Piped link to namespace
3944 !! input
3945 [[Meta:Disclaimers|The disclaimers]]
3946 !! result
3947 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
3948 </p>
3949 !! end
3950
3951 !! test
3952 Link containing }
3953 !! input
3954 [[Usually caused by a typo (oops}]]
3955 !! result
3956 <p>[[Usually caused by a typo (oops}]]
3957 </p>
3958 !! end
3959
3960 !! test
3961 Link containing % (not as a hex sequence)
3962 !! input
3963 [[7% Solution]]
3964 !! result
3965 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
3966 </p>
3967 !! end
3968
3969 !! test
3970 Link containing % as a single hex sequence interpreted to char
3971 !! input
3972 [[7%25 Solution]]
3973 !! result
3974 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
3975 </p>
3976 !!end
3977
3978 !! test
3979 Link containing % as a double hex sequence interpreted to hex sequence
3980 !! input
3981 [[7%2525 Solution]]
3982 !! result
3983 <p>[[7%2525 Solution]]
3984 </p>
3985 !!end
3986
3987 !! test
3988 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3989 Example for such a section: == < ==
3990 !! input
3991 [[%23%3c]][[%23%3e]]
3992 !! result
3993 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3994 </p>
3995 !! end
3996
3997 !! test
3998 Link containing "<#" and ">#" as a hex sequences
3999 !! input
4000 [[%3c%23]][[%3e%23]]
4001 !! result
4002 <p>[[%3c%23]][[%3e%23]]
4003 </p>
4004 !! end
4005
4006 !! test
4007 Link containing an equals sign
4008 !! input
4009 [[Special:BookSources/isbn=4-00-026157-6]]
4010 !! result
4011 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
4012 </p>
4013 !! end
4014
4015 !! article
4016 Foo~bar
4017 !! text
4018 Just a test of an article title containing a tilde.
4019 !! endarticle
4020
4021 # note that links containing signatures, like [[Foo~~~~]], are
4022 # massaged by the pre-save transform (PST) and so the tildes are never
4023 # seen by the parser.
4024 !! test
4025 Link containing a tilde
4026 !! input
4027 [[Foo~bar]]
4028 !! result
4029 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4030 </p>
4031 !! end
4032
4033 !! test
4034 Link containing double-single-quotes '' (bug 4598)
4035 !! input
4036 [[Lista d''e paise d''o munno]]
4037 !! result
4038 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
4039 </p>
4040 !! end
4041
4042 !! test
4043 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4044 !! input
4045 Some [[Link|pretty ''italics'' and stuff]]!
4046 !! result
4047 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
4048 </p>
4049 !! end
4050
4051 !! test
4052 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4053 !! input
4054 ''Some [[Link|pretty ''italics'' and stuff]]!
4055 !! result
4056 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
4057 </p>
4058 !! end
4059
4060 !! test
4061 Link with double quotes in title part (literal) and alternate part (interpreted)
4062 !! input
4063 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4064
4065 [[''Pentecoste'']]
4066
4067 [[''Pentecoste''|Pentecoste]]
4068
4069 [[''Pentecoste''|''Pentecoste'']]
4070 !! result
4071 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
4072 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
4073 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
4074 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
4075 </p>
4076 !! end
4077
4078 !! test
4079 Broken image links with HTML captions (bug 39700)
4080 !! input
4081 [[File:Nonexistent|<script></script>]]
4082 [[File:Nonexistent|100px|<script></script>]]
4083 [[File:Nonexistent|&lt;]]
4084 [[File:Nonexistent|a<i>b</i>c]]
4085 !! result
4086 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4087 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4088 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4089 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4090 </p>
4091 !! end
4092
4093 !! test
4094 Plain link to URL
4095 !! input
4096 [[http://www.example.com]]
4097 !! result
4098 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4099 </p>
4100 !! end
4101
4102 !! test
4103 Plain link to URL with link text
4104 !! input
4105 [[http://www.example.com Link text]]
4106 !! result
4107 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4108 </p>
4109 !! end
4110
4111 !! test
4112 Plain link to protocol-relative URL
4113 !! input
4114 [[//www.example.com]]
4115 !! result
4116 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4117 </p>
4118 !! end
4119
4120 !! test
4121 Plain link to protocol-relative URL with link text
4122 !! input
4123 [[//www.example.com Link text]]
4124 !! result
4125 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4126 </p>
4127 !! end
4128
4129 !! test
4130 Plain link to page with question mark in title
4131 !! input
4132 [[A?b]]
4133
4134 [[A?b|Baz]]
4135 !! result
4136 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4137 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4138 </p>
4139 !! end
4140
4141
4142 # I'm fairly sure the expected result here is wrong.
4143 # We want these to be URL links, not pseudo-pages with URLs for titles....
4144 # However the current output is also pretty screwy.
4145 #
4146 # ----
4147 # I'm changing it to match the current output--it arguably makes more
4148 # sense in the light of the test above. Old expected result was:
4149 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4150 #</p>
4151 # But I think this test is bordering on "garbage in, garbage out" anyway.
4152 # -- wtm
4153 !! test
4154 Piped link to URL
4155 !! input
4156 Piped link to URL: [[http://www.example.com|an example URL]]
4157 !! result
4158 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4159 </p>
4160 !! end
4161
4162 !! test
4163 BUG 2: [[page|http://url/]] should link to page, not http://url/
4164 !! input
4165 [[Main Page|http://url/]]
4166 !! result
4167 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4168 </p>
4169 !! end
4170
4171 !! test
4172 BUG 337: Escaped self-links should be bold
4173 !! options
4174 title=[[Bug462]]
4175 !! input
4176 [[Bu&#103;462]] [[Bug462]]
4177 !! result
4178 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4179 </p>
4180 !! end
4181
4182 !! test
4183 Self-link to section should not be bold
4184 !! options
4185 title=[[Main Page]]
4186 !! input
4187 [[Main Page#section]]
4188 !! result
4189 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4190 </p>
4191 !! end
4192
4193 !! article
4194 00
4195 !! text
4196 This is 00.
4197 !! endarticle
4198
4199 !!test
4200 Self-link to numeric title
4201 !!options
4202 title=[[0]]
4203 !!input
4204 [[0]]
4205 !!result
4206 <p><strong class="selflink">0</strong>
4207 </p>
4208 !!end
4209
4210 !!test
4211 Link to numeric-equivalent title
4212 !!options
4213 title=[[0]]
4214 !!input
4215 [[00]]
4216 !!result
4217 <p><a href="/wiki/00" title="00">00</a>
4218 </p>
4219 !!end
4220
4221 !! test
4222 <nowiki> inside a link
4223 !! input
4224 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4225 !! result
4226 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4227 </p>
4228 !! end
4229
4230 !! test
4231 Non-breaking spaces in title
4232 !! input
4233 [[&nbsp; Main &nbsp; Page &nbsp;]]
4234 !! result
4235 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4236 </p>
4237 !!end
4238
4239 !! test
4240 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4241 !! options
4242 language=ca
4243 !! input
4244 '''[[Main Page]]'''
4245 !! result
4246 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4247 </p>
4248 !! end
4249
4250 !! test
4251 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4252 !! options
4253 language=ca
4254 !! input
4255 ''[[Main Page]]''
4256 !! result
4257 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4258 </p>
4259 !! end
4260
4261 !! test
4262 Internal link with en linktrail: no apostrophes (bug 27473)
4263 !! options
4264 language=en
4265 !! input
4266 [[Something]]'nice
4267 !! result
4268 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4269 </p>
4270 !! end
4271
4272 !! test
4273 Internal link with ca linktrail with apostrophes (bug 27473)
4274 !! options
4275 language=ca
4276 !! input
4277 [[Something]]'nice
4278 !! result
4279 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4280 </p>
4281 !! end
4282
4283 !! test
4284 Internal link with kaa linktrail with apostrophes (bug 27473)
4285 !! options
4286 language=kaa
4287 !! input
4288 [[Something]]'nice
4289 !! result
4290 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
4291 </p>
4292 !! end
4293
4294 !! article
4295 Söfnuður
4296 !! text
4297 Test.
4298 !! endarticle
4299
4300 !! test
4301 Internal link with is link prefix
4302 !! options
4303 language=is
4304 !! input
4305 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4306 !! result
4307 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4308 </p>
4309 !! end
4310
4311 !! article
4312 Mótmælendatrú
4313 !! text
4314 Test.
4315 !! endarticle
4316
4317 !! test
4318 Internal link with is link trail and link prefix
4319 !! options
4320 language=is
4321 !! input
4322 [[mótmælendatrú|xxx]]ar
4323 [[mótmælendatrú]]ar
4324 mótmælenda[[söfnuður]]
4325 mótmælenda[[söfnuður|söfnuðir]]
4326 mótmælenda[[söfnuður|söfnuðir]]xxx
4327 !! result
4328 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4329 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4330 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4331 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4332 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4333 </p>
4334 !! end
4335
4336 !! test
4337 Parsoid link trail escaping
4338 !! options
4339 parsoid=html2wt,html2html
4340 !! input
4341 [[apple]]<nowiki/>s
4342 !! result
4343 <p><a rel="mw:WikiLink" href="Apple">apple</a>s</p>
4344 !! end
4345
4346 !! test
4347 Parsoid link prefix escaping
4348 !! options
4349 language=is
4350 parsoid=html2wt,html2html
4351 !! input
4352 Aðrir mótmælenda<nowiki/>[[söfnuður]]
4353 !! result
4354 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður">söfnuður</a></p>
4355 !! end
4356
4357 !! test
4358 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4359 !! input
4360 [[Foo| bar]]
4361
4362 [[Foo| ''bar'']]
4363
4364 [http://wp.org foo]
4365
4366 [http://wp.org ''foo'']
4367 !! result
4368 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4369 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
4370 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4371 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4372 </p>
4373 !! end
4374
4375 ###
4376 ### Interwiki links (see maintenance/interwiki.sql)
4377 ###
4378
4379 !! test
4380 Inline interwiki link
4381 !! input
4382 [[MeatBall:SoftSecurity]]
4383 !! result
4384 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4385 </p>
4386 !! end
4387
4388 !! test
4389 Inline interwiki link with empty title (bug 2372)
4390 !! input
4391 [[MeatBall:]]
4392 !! result
4393 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4394 </p>
4395 !! end
4396
4397 !! test
4398 Interwiki link encoding conversion (bug 1636)
4399 !! input
4400 *[[Wikipedia:ro:Olteni&#0355;a]]
4401 *[[Wikipedia:ro:Olteni&#355;a]]
4402 !! result
4403 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
4404 </li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
4405 </li></ul>
4406
4407 !! end
4408
4409 !! test
4410 Interwiki link with fragment (bug 2130)
4411 !! input
4412 [[MeatBall:SoftSecurity#foo]]
4413 !! result
4414 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4415 </p>
4416 !! end
4417
4418 !! test
4419 Interlanguage link
4420 !! input
4421 Blah blah blah
4422 [[zh:Chinese]]
4423 !!result
4424 <p>Blah blah blah
4425 </p>
4426 !! end
4427
4428 !! test
4429 Double interlanguage link
4430 !! input
4431 Blah blah blah
4432 [[es:Spanish]]
4433 [[zh:Chinese]]
4434 !!result
4435 <p>Blah blah blah
4436 </p>
4437 !! end
4438
4439 !! test
4440 Interlanguage link, with prefix links
4441 !! options
4442 language=ln
4443 !! input
4444 Blah blah blah
4445 [[zh:Chinese]]
4446 !!result
4447 <p>Blah blah blah
4448 </p>
4449 !! end
4450
4451 !! test
4452 Double interlanguage link, with prefix links (bug 8897)
4453 !! options
4454 language=ln
4455 !! input
4456 Blah blah blah
4457 [[es:Spanish]]
4458 [[zh:Chinese]]
4459 !!result
4460 <p>Blah blah blah
4461 </p>
4462 !! end
4463
4464 !! test
4465 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4466 !! options
4467 language=ln
4468 !! input
4469 [[WW&nbsp;II]]
4470 !!result
4471 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
4472 </p>
4473 !! end
4474
4475 ##
4476 ## XHTML tidiness
4477 ###
4478
4479 !! test
4480 <br> to <br />
4481 !! input
4482 1<br>2<br />3
4483 !! result
4484 <p>1<br />2<br />3
4485 </p>
4486 !! end
4487
4488 !! test
4489 Broken br tag sanitization
4490 !! input
4491 </br>
4492 !! result
4493 <p>&lt;/br&gt;
4494 </p>
4495 !! end
4496
4497 !! test
4498 Incorrecly removing closing slashes from correctly formed XHTML
4499 !! input
4500 <br style="clear:both;" />
4501 !! result
4502 <p><br style="clear:both;" />
4503 </p>
4504 !! end
4505
4506 !! test
4507 Failing to transform badly formed HTML into correct XHTML
4508 !! input
4509 <br style="clear: left;">
4510 <br style="clear: right;">
4511 <br style="clear: both;">
4512 !! result
4513 <p><br style="clear: left;" />
4514 <br style="clear: right;" />
4515 <br style="clear: both;" />
4516 </p>
4517 !!end
4518
4519 !! test
4520 Handling html with a div self-closing tag
4521 !! input
4522 <div title />
4523 <div title/>
4524 <div title/ >
4525 <div title=bar />
4526 <div title=bar/>
4527 <div title=bar/ >
4528 !! result
4529 <p>&lt;div title /&gt;
4530 &lt;div title/&gt;
4531 </p>
4532 <div>
4533 <p>&lt;div title=bar /&gt;
4534 &lt;div title=bar/&gt;
4535 </p>
4536 <div title="bar/"></div>
4537 </div>
4538
4539 !! end
4540
4541 !! test
4542 Handling html with a br self-closing tag
4543 !! input
4544 <br title />
4545 <br title/>
4546 <br title/ >
4547 <br title=bar />
4548 <br title=bar/>
4549 <br title=bar/ >
4550 !! result
4551 <p><br title="title" />
4552 <br title="title" />
4553 <br />
4554 <br title="bar" />
4555 <br title="bar" />
4556 <br title="bar/" />
4557 </p>
4558 !! end
4559
4560 !! test
4561 Horizontal ruler (should it add that extra space?)
4562 !! input
4563 <hr>
4564 <hr >
4565 foo <hr
4566 > bar
4567 !! result
4568 <hr />
4569 <hr />
4570 foo <hr /> bar
4571
4572 !! end
4573
4574 !! test
4575 Horizontal ruler -- 4+ dashes render hr
4576 !! input
4577 ----
4578 !! result
4579 <hr />
4580
4581 !! end
4582
4583 !! test
4584 Horizontal ruler -- eats additional dashes on the same line
4585 !! input
4586 ---------
4587 !! result
4588 <hr />
4589
4590 !! end
4591
4592 !! test
4593 Horizontal ruler -- does not collapse dashes on consecutive lines
4594 !! input
4595 ----
4596 ----
4597 !! result
4598 <hr />
4599 <hr />
4600
4601 !! end
4602
4603 !! test
4604 Horizontal ruler -- <4 dashes render as plain text
4605 !! input
4606 ---
4607 !! result
4608 <p>---
4609 </p>
4610 !! end
4611
4612 !! test
4613 Horizontal ruler -- Supports content following dashes on same line
4614 !! input
4615 ---- Foo
4616 !! result
4617 <hr /> Foo
4618
4619 !! end
4620
4621 ###
4622 ### Block-level elements
4623 ###
4624 !! test
4625 Common list
4626 !! input
4627 *Common list
4628 * item 2
4629 *item 3
4630 !! result
4631 <ul><li>Common list
4632 </li><li> item 2
4633 </li><li>item 3
4634 </li></ul>
4635
4636 !! end
4637
4638 !! test
4639 Numbered list
4640 !! input
4641 #Numbered list
4642 #item 2
4643 # item 3
4644 !! result
4645 <ol><li>Numbered list
4646 </li><li>item 2
4647 </li><li> item 3
4648 </li></ol>
4649
4650 !! end
4651
4652 !! test
4653 Mixed list
4654 !! input
4655 *Mixed list
4656 *# with numbers
4657 ** and bullets
4658 *# and numbers
4659 *bullets again
4660 **bullet level 2
4661 ***bullet level 3
4662 ***#Number on level 4
4663 **bullet level 2
4664 **#Number on level 3
4665 **#Number on level 3
4666 *#number level 2
4667 *Level 1
4668 *** Level 3
4669 #** Level 3, but ordered
4670 !! result
4671 <ul><li>Mixed list
4672 <ol><li> with numbers
4673 </li></ol>
4674 <ul><li> and bullets
4675 </li></ul>
4676 <ol><li> and numbers
4677 </li></ol>
4678 </li><li>bullets again
4679 <ul><li>bullet level 2
4680 <ul><li>bullet level 3
4681 <ol><li>Number on level 4
4682 </li></ol>
4683 </li></ul>
4684 </li><li>bullet level 2
4685 <ol><li>Number on level 3
4686 </li><li>Number on level 3
4687 </li></ol>
4688 </li></ul>
4689 <ol><li>number level 2
4690 </li></ol>
4691 </li><li>Level 1
4692 <ul><li><ul><li> Level 3
4693 </li></ul>
4694 </li></ul>
4695 </li></ul>
4696 <ol><li><ul><li><ul><li> Level 3, but ordered
4697 </li></ul>
4698 </li></ul>
4699 </li></ol>
4700
4701 !! end
4702
4703 !! test
4704 Nested lists 1
4705 !! input
4706 *foo
4707 **bar
4708 !! result
4709 <ul><li>foo
4710 <ul><li>bar
4711 </li></ul>
4712 </li></ul>
4713
4714 !! end
4715
4716 !! test
4717 Nested lists 2
4718 !! input
4719 **foo
4720 *bar
4721 !! result
4722 <ul><li><ul><li>foo
4723 </li></ul>
4724 </li><li>bar
4725 </li></ul>
4726
4727 !! end
4728
4729 !! test
4730 Nested lists 3 (first element empty)
4731 !! input
4732 *
4733 **bar
4734 !! result
4735 <ul><li>
4736 <ul><li>bar
4737 </li></ul>
4738 </li></ul>
4739
4740 !! end
4741
4742 !! test
4743 Nested lists 4 (first element empty)
4744 !! input
4745 **
4746 *bar
4747 !! result
4748 <ul><li><ul><li>
4749 </li></ul>
4750 </li><li>bar
4751 </li></ul>
4752
4753 !! end
4754
4755 !! test
4756 Nested lists 5 (both elements empty)
4757 !! input
4758 **
4759 *
4760 !! result
4761 <ul><li><ul><li>
4762 </li></ul>
4763 </li><li>
4764 </li></ul>
4765
4766 !! end
4767
4768 !! test
4769 Nested lists 6 (both elements empty)
4770 !! input
4771 *
4772 **
4773 !! result
4774 <ul><li>
4775 <ul><li>
4776 </li></ul>
4777 </li></ul>
4778
4779 !! end
4780
4781 !! test
4782 Nested lists 7 (skip initial nesting levels)
4783 !! input
4784 *** foo
4785 !! result
4786 <ul><li><ul><li><ul><li> foo
4787 </li></ul>
4788 </li></ul>
4789 </li></ul>
4790
4791 !! end
4792
4793 !! test
4794 Nested lists 8 (multiple nesting transitions)
4795 !! input
4796 * foo
4797 *** bar
4798 ** baz
4799 * boo
4800 !! result
4801 <ul><li> foo
4802 <ul><li><ul><li> bar
4803 </li></ul>
4804 </li><li> baz
4805 </li></ul>
4806 </li><li> boo
4807 </li></ul>
4808
4809 !! end
4810
4811 !! test
4812 1. Lists with start-of-line-transparent tokens before bullets: Comments
4813 !! input
4814 *foo
4815 *<!--cmt-->bar
4816 <!--cmt-->*baz
4817 !! result
4818 <ul><li>foo
4819 </li><li>bar
4820 </li><li>baz
4821 </li></ul>
4822
4823 !! end
4824
4825 !! test
4826 2. Lists with start-of-line-transparent tokens before bullets: Template close
4827 !! input
4828 *foo {{echo|bar
4829 }}*baz
4830 !! result
4831 <ul><li>foo bar
4832 </li><li>baz
4833 </li></ul>
4834
4835 !! end
4836
4837 !! test
4838 Unbalanced closing block tags break a list
4839 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4840 !! options
4841 parsoid
4842 !! input
4843 <div>
4844 *a</div><div>
4845 *b</div>
4846 !! result
4847 <div>
4848 <ul><li>a
4849 </li></ul></div><div>
4850 <ul><li>b
4851 </li></ul></div>
4852 !! end
4853
4854 !! test
4855 Unbalanced closing non-block tags don't break a list
4856 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4857 !! options
4858 parsoid
4859 !! input
4860 <span>
4861 *a</span><span>
4862 *b</span>
4863 !! result
4864 <p><span></span>
4865 </p>
4866 <ul><li>a<span></span>
4867 </li><li>b
4868 </li></ul>
4869 !! end
4870
4871 !! test
4872 Unclosed formatting tags that straddle lists are closed and reopened
4873 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4874 !! options
4875 parsoid
4876 !! input
4877 # <s> a
4878 # b </s>
4879 !! result
4880 <ol><li> <s> a </s>
4881 </li><li> <s> b </s>
4882 </li></ol>
4883 !! end
4884
4885 !!test
4886 List embedded in a non-block tag
4887 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4888 !! options
4889 parsoid
4890 !!input
4891 <small>
4892 * foo
4893 </small>
4894 !!result
4895 <p><small></small></p>
4896 <small>
4897 <ul>
4898 <li> foo</li>
4899 </ul>
4900 </small>
4901 <p><small></small></p>
4902 !!end
4903
4904 !! test
4905 List items are not parsed correctly following a <pre> block (bug 785)
4906 !! input
4907 * <pre>foo</pre>
4908 * <pre>bar</pre>
4909 * zar
4910 !! result
4911 <ul><li> <pre>foo</pre>
4912 </li><li> <pre>bar</pre>
4913 </li><li> zar
4914 </li></ul>
4915
4916 !! end
4917
4918 !! test
4919 List items from template
4920 !! input
4921
4922 {{inner list}}
4923 * item 2
4924
4925 * item 0
4926 {{inner list}}
4927 * item 2
4928
4929 * item 0
4930 * notSOL{{inner list}}
4931 * item 2
4932 !! result
4933 <ul><li> item 1
4934 </li><li> item 2
4935 </li></ul>
4936 <ul><li> item 0
4937 </li><li> item 1
4938 </li><li> item 2
4939 </li></ul>
4940 <ul><li> item 0
4941 </li><li> notSOL
4942 </li><li> item 1
4943 </li><li> item 2
4944 </li></ul>
4945
4946 !! end
4947
4948 !! test
4949 List interrupted by empty line or heading
4950 !! input
4951 * foo
4952
4953 ** bar
4954 == A heading ==
4955 * Another list item
4956 !! result
4957 <ul><li> foo
4958 </li></ul>
4959 <ul><li><ul><li> bar
4960 </li></ul>
4961 </li></ul>
4962 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a>]</span></h2>
4963 <ul><li> Another list item
4964 </li></ul>
4965
4966 !!end
4967
4968 !!test
4969 Multiple list tags generated by templates
4970 !!input
4971 {{echo|<li>}}a
4972 {{echo|<li>}}b
4973 {{echo|<li>}}c
4974 !!result
4975 <li>a
4976 <li>b
4977 <li>c</li>
4978 </li>
4979 </li>
4980
4981 !!end
4982
4983 !!test
4984 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
4985 !!input
4986 *a
4987 <!--This line will NOT split the list-->
4988 *b
4989 <!--This line will NOT split the list either-->
4990 *c
4991 <!--foo--> <!--This line with more than 1 comment will split the list-->
4992 *d
4993 !!result
4994 <ul><li>a
4995 </li><li>b
4996 </li><li>c
4997 </li></ul>
4998 <ul><li>d
4999 </li></ul>
5000
5001 !!end
5002
5003 ###
5004 ### Magic Words
5005 ###
5006
5007 !! test
5008 Magic Word: {{CURRENTDAY}}
5009 !! input
5010 {{CURRENTDAY}}
5011 !! result
5012 <p>1
5013 </p>
5014 !! end
5015
5016 !! test
5017 Magic Word: {{CURRENTDAY2}}
5018 !! input
5019 {{CURRENTDAY2}}
5020 !! result
5021 <p>01
5022 </p>
5023 !! end
5024
5025 !! test
5026 Magic Word: {{CURRENTDAYNAME}}
5027 !! input
5028 {{CURRENTDAYNAME}}
5029 !! result
5030 <p>Thursday
5031 </p>
5032 !! end
5033
5034 !! test
5035 Magic Word: {{CURRENTDOW}}
5036 !! input
5037 {{CURRENTDOW}}
5038 !! result
5039 <p>4
5040 </p>
5041 !! end
5042
5043 !! test
5044 Magic Word: {{CURRENTMONTH}}
5045 !! input
5046 {{CURRENTMONTH}}
5047 !! result
5048 <p>01
5049 </p>
5050 !! end
5051
5052 !! test
5053 Magic Word: {{CURRENTMONTHABBREV}}
5054 !! input
5055 {{CURRENTMONTHABBREV}}
5056 !! result
5057 <p>Jan
5058 </p>
5059 !! end
5060
5061 !! test
5062 Magic Word: {{CURRENTMONTHNAME}}
5063 !! input
5064 {{CURRENTMONTHNAME}}
5065 !! result
5066 <p>January
5067 </p>
5068 !! end
5069
5070 !! test
5071 Magic Word: {{CURRENTMONTHNAMEGEN}}
5072 !! input
5073 {{CURRENTMONTHNAMEGEN}}
5074 !! result
5075 <p>January
5076 </p>
5077 !! end
5078
5079 !! test
5080 Magic Word: {{CURRENTTIME}}
5081 !! input
5082 {{CURRENTTIME}}
5083 !! result
5084 <p>00:02
5085 </p>
5086 !! end
5087
5088 !! test
5089 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5090 !! input
5091 {{CURRENTWEEK}}
5092 !! result
5093 <p>1
5094 </p>
5095 !! end
5096
5097 !! test
5098 Magic Word: {{CURRENTYEAR}}
5099 !! input
5100 {{CURRENTYEAR}}
5101 !! result
5102 <p>1970
5103 </p>
5104 !! end
5105
5106 !! test
5107 Magic Word: {{FULLPAGENAME}}
5108 !! options
5109 title=[[User:Ævar Arnfjörð Bjarmason]]
5110 !! input
5111 {{FULLPAGENAME}}
5112 !! result
5113 <p>User:Ævar Arnfjörð Bjarmason
5114 </p>
5115 !! end
5116
5117 !! test
5118 Magic Word: {{FULLPAGENAMEE}}
5119 !! options
5120 title=[[User:Ævar Arnfjörð Bjarmason]]
5121 !! input
5122 {{FULLPAGENAMEE}}
5123 !! result
5124 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5125 </p>
5126 !! end
5127
5128 !! test
5129 Magic Word: {{NAMESPACE}}
5130 !! options
5131 title=[[User:Ævar Arnfjörð Bjarmason]]
5132 !! input
5133 {{NAMESPACE}}
5134 !! result
5135 <p>User
5136 </p>
5137 !! end
5138
5139 !! test
5140 Magic Word: {{NAMESPACEE}}
5141 !! options
5142 title=[[User:Ævar Arnfjörð Bjarmason]]
5143 !! input
5144 {{NAMESPACEE}}
5145 !! result
5146 <p>User
5147 </p>
5148 !! end
5149
5150 !! test
5151 Magic Word: {{NAMESPACENUMBER}}
5152 !! options
5153 title=[[User:Ævar Arnfjörð Bjarmason]]
5154 !! input
5155 {{NAMESPACENUMBER}}
5156 !! result
5157 <p>2
5158 </p>
5159 !! end
5160
5161 !! test
5162 Magic Word: {{NUMBEROFFILES}}
5163 !! input
5164 {{NUMBEROFFILES}}
5165 !! result
5166 <p>3
5167 </p>
5168 !! end
5169
5170 !! test
5171 Magic Word: {{PAGENAME}}
5172 !! options
5173 title=[[User:Ævar Arnfjörð Bjarmason]]
5174 !! input
5175 {{PAGENAME}}
5176 !! result
5177 <p>Ævar Arnfjörð Bjarmason
5178 </p>
5179 !! end
5180
5181 !! test
5182 Magic Word: {{PAGENAME}} with metacharacters
5183 !! options
5184 title=[['foo & bar = baz']]
5185 !! input
5186 ''{{PAGENAME}}''
5187 !! result
5188 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5189 </p>
5190 !! end
5191
5192 !! test
5193 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5194 !! options
5195 title=[[*RFC 1234 http://example.com/]]
5196 !! input
5197 {{PAGENAME}}
5198 !! result
5199 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5200 </p>
5201 !! end
5202
5203 !! test
5204 Magic Word: {{PAGENAMEE}}
5205 !! options
5206 title=[[User:Ævar Arnfjörð Bjarmason]]
5207 !! input
5208 {{PAGENAMEE}}
5209 !! result
5210 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5211 </p>
5212 !! end
5213
5214 !! test
5215 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5216 !! options
5217 title=[[*RFC 1234 http://example.com/]]
5218 !! input
5219 {{PAGENAMEE}}
5220 !! result
5221 <p>&#42;RFC_1234_http&#58;//example.com/
5222 </p>
5223 !! end
5224
5225 !! test
5226 Magic Word: {{REVISIONID}}
5227 !! input
5228 {{REVISIONID}}
5229 !! result
5230 <p>1337
5231 </p>
5232 !! end
5233
5234 !! test
5235 Magic Word: {{SCRIPTPATH}}
5236 !! input
5237 {{SCRIPTPATH}}
5238 !! result
5239 <p>/
5240 </p>
5241 !! end
5242
5243 !! test
5244 Magic Word: {{SERVER}}
5245 !! input
5246 {{SERVER}}
5247 !! result
5248 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5249 </p>
5250 !! end
5251
5252 !! test
5253 Magic Word: {{SERVERNAME}}
5254 !! input
5255 {{SERVERNAME}}
5256 !! result
5257 <p>example.org
5258 </p>
5259 !! end
5260
5261 !! test
5262 Magic Word: {{SITENAME}}
5263 !! input
5264 {{SITENAME}}
5265 !! result
5266 <p>MediaWiki
5267 </p>
5268 !! end
5269
5270 !! test
5271 Case-sensitive magic words, when cased differently, should just be template transclusions
5272 !! input
5273 {{CurrentMonth}}
5274 {{currentday}}
5275 {{cURreNTweEK}}
5276 {{currentHour}}
5277 !! result
5278 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
5279 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
5280 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
5281 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
5282 </p>
5283 !! end
5284
5285 !! test
5286 Case-insensitive magic words should still work with weird casing.
5287 !! input
5288 {{sErVeRNaMe}}
5289 {{LCFirst:AOEU}}
5290 {{ucFIRST:aoeu}}
5291 {{SERver}}
5292 !! result
5293 <p>example.org
5294 aOEU
5295 Aoeu
5296 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5297 </p>
5298 !! end
5299
5300 !! test
5301 Namespace 1 {{ns:1}}
5302 !! input
5303 {{ns:1}}
5304 !! result
5305 <p>Talk
5306 </p>
5307 !! end
5308
5309 !! test
5310 Namespace 1 {{ns:01}}
5311 !! input
5312 {{ns:01}}
5313 !! result
5314 <p>Talk
5315 </p>
5316 !! end
5317
5318 !! test
5319 Namespace 0 {{ns:0}} (bug 4783)
5320 !! input
5321 {{ns:0}}
5322 !! result
5323
5324 !! end
5325
5326 !! test
5327 Namespace 0 {{ns:00}} (bug 4783)
5328 !! input
5329 {{ns:00}}
5330 !! result
5331
5332 !! end
5333
5334 !! test
5335 Namespace -1 {{ns:-1}}
5336 !! input
5337 {{ns:-1}}
5338 !! result
5339 <p>Special
5340 </p>
5341 !! end
5342
5343 !! test
5344 Namespace User {{ns:User}}
5345 !! input
5346 {{ns:User}}
5347 !! result
5348 <p>User
5349 </p>
5350 !! end
5351
5352 !! test
5353 Namespace User talk {{ns:User_talk}}
5354 !! input
5355 {{ns:User_talk}}
5356 !! result
5357 <p>User talk
5358 </p>
5359 !! end
5360
5361 !! test
5362 Namespace User talk {{ns:uSeR tAlK}}
5363 !! input
5364 {{ns:uSeR tAlK}}
5365 !! result
5366 <p>User talk
5367 </p>
5368 !! end
5369
5370 !! test
5371 Namespace File {{ns:File}}
5372 !! input
5373 {{ns:File}}
5374 !! result
5375 <p>File
5376 </p>
5377 !! end
5378
5379 !! test
5380 Namespace File {{ns:Image}}
5381 !! input
5382 {{ns:Image}}
5383 !! result
5384 <p>File
5385 </p>
5386 !! end
5387
5388 !! test
5389 Namespace (lang=de) Benutzer {{ns:User}}
5390 !! options
5391 language=de
5392 !! input
5393 {{ns:User}}
5394 !! result
5395 <p>Benutzer
5396 </p>
5397 !! end
5398
5399 !! test
5400 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5401 !! options
5402 language=de
5403 !! input
5404 {{ns:3}}
5405 !! result
5406 <p>Benutzer Diskussion
5407 </p>
5408 !! end
5409
5410
5411 !! test
5412 Urlencode
5413 !! input
5414 {{urlencode:hi world?!}}
5415 {{urlencode:hi world?!|WIKI}}
5416 {{urlencode:hi world?!|PATH}}
5417 {{urlencode:hi world?!|QUERY}}
5418 !! result
5419 <p>hi+world%3F%21
5420 hi_world%3F!
5421 hi%20world%3F%21
5422 hi+world%3F%21
5423 </p>
5424 !! end
5425
5426 ###
5427 ### Magic links
5428 ###
5429 !! test
5430 Magic links: internal link to RFC (bug 479)
5431 !! input
5432 [[RFC 123]]
5433 !! result
5434 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
5435 </p>
5436 !! end
5437
5438 !! test
5439 Magic links: RFC (bug 479)
5440 !! input
5441 RFC 822
5442 !! result
5443 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5444 </p>
5445 !! end
5446
5447 !! test
5448 Magic links: ISBN (bug 1937)
5449 !! input
5450 ISBN 0-306-40615-2
5451 !! result
5452 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5453 </p>
5454 !! end
5455
5456 !! test
5457 Magic links: PMID incorrectly converts space to underscore
5458 !! input
5459 PMID 1234
5460 !! result
5461 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5462 </p>
5463 !! end
5464
5465 ###
5466 ### Templates
5467 ####
5468
5469 !! test
5470 Nonexistent template
5471 !! input
5472 {{thistemplatedoesnotexist}}
5473 !! result
5474 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
5475 </p>
5476 !! end
5477
5478 !! test
5479 Template with invalid target containing tags
5480 !! input
5481 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5482 !! result
5483 <p>{{a<b>b</b>|foo|a=b|a = b}}
5484 </p>
5485 !! end
5486
5487 !! test
5488 Template with invalid target containing unclosed tag
5489 !! input
5490 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5491 !! result
5492 <p>{{a<b>|foo|a=b|a = b}}</b>
5493 </p>
5494 !! end
5495
5496 !! article
5497 Template:test
5498 !! text
5499 This is a test template
5500 !! endarticle
5501
5502 !! test
5503 Simple template
5504 !! input
5505 {{test}}
5506 !! result
5507 <p>This is a test template
5508 </p>
5509 !! end
5510
5511 !! test
5512 Template with explicit namespace
5513 !! input
5514 {{Template:test}}
5515 !! result
5516 <p>This is a test template
5517 </p>
5518 !! end
5519
5520
5521 !! article
5522 Template:paramtest
5523 !! text
5524 This is a test template with parameter {{{param}}}
5525 !! endarticle
5526
5527 !! test
5528 Template parameter
5529 !! input
5530 {{paramtest|param=foo}}
5531 !! result
5532 <p>This is a test template with parameter foo
5533 </p>
5534 !! end
5535
5536 !! article
5537 Template:paramtestnum
5538 !! text
5539 [[{{{1}}}|{{{2}}}]]
5540 !! endarticle
5541
5542 !! test
5543 Template unnamed parameter
5544 !! input
5545 {{paramtestnum|Main Page|the main page}}
5546 !! result
5547 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5548 </p>
5549 !! end
5550
5551 !! article
5552 Template:templatesimple
5553 !! text
5554 (test)
5555 !! endarticle
5556
5557 !! article
5558 Template:templateredirect
5559 !! text
5560 #redirect [[Template:templatesimple]]
5561 !! endarticle
5562
5563 !! article
5564 Template:templateasargtestnum
5565 !! text
5566 {{{{{1}}}}}
5567 !! endarticle
5568
5569 !! article
5570 Template:templateasargtest
5571 !! text
5572 {{template{{{templ}}}}}
5573 !! endarticle
5574
5575 !! article
5576 Template:templateasargtest2
5577 !! text
5578 {{{{{templ}}}}}
5579 !! endarticle
5580
5581 !! test
5582 Template with template name as unnamed argument
5583 !! input
5584 {{templateasargtestnum|templatesimple}}
5585 !! result
5586 <p>(test)
5587 </p>
5588 !! end
5589
5590 !! test
5591 Template with template name as argument
5592 !! input
5593 {{templateasargtest|templ=simple}}
5594 !! result
5595 <p>(test)
5596 </p>
5597 !! end
5598
5599 !! test
5600 Template with template name as argument (2)
5601 !! input
5602 {{templateasargtest2|templ=templatesimple}}
5603 !! result
5604 <p>(test)
5605 </p>
5606 !! end
5607
5608 !! article
5609 Template:templateasargtestdefault
5610 !! text
5611 {{{{{templ|templatesimple}}}}}
5612 !! endarticle
5613
5614 !! article
5615 Template:templa
5616 !! text
5617 '''templ'''
5618 !! endarticle
5619
5620 !! test
5621 Template with default value
5622 !! input
5623 {{templateasargtestdefault}}
5624 !! result
5625 <p>(test)
5626 </p>
5627 !! end
5628
5629 !! test
5630 Template with default value (value set)
5631 !! input
5632 {{templateasargtestdefault|templ=templa}}
5633 !! result
5634 <p><b>templ</b>
5635 </p>
5636 !! end
5637
5638 !! test
5639 Template redirect
5640 !! input
5641 {{templateredirect}}
5642 !! result
5643 <p>(test)
5644 </p>
5645 !! end
5646
5647 !! test
5648 Template with argument in separate line
5649 !! input
5650 {{ templateasargtest |
5651 templ = simple }}
5652 !! result
5653 <p>(test)
5654 </p>
5655 !! end
5656
5657 !! test
5658 Template with complex template as argument
5659 !! input
5660 {{paramtest|
5661 param ={{ templateasargtest |
5662 templ = simple }}}}
5663 !! result
5664 <p>This is a test template with parameter (test)
5665 </p>
5666 !! end
5667
5668 !! test
5669 Template with thumb image (with link in description)
5670 !! input
5671 {{paramtest|
5672 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5673 !! result
5674 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
5675
5676 !! end
5677
5678 !! article
5679 Template:complextemplate
5680 !! text
5681 {{{1}}} {{paramtest|
5682 param ={{{param}}}}}
5683 !! endarticle
5684
5685 !! test
5686 Template with complex arguments
5687 !! input
5688 {{complextemplate|
5689 param ={{ templateasargtest |
5690 templ = simple }}|[[Template:complextemplate|link]]}}
5691 !! result
5692 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5693 </p>
5694 !! end
5695
5696 !! test
5697 BUG 553: link with two variables in a piped link
5698 !! input
5699 {|
5700 |[[{{{1}}}|{{{2}}}]]
5701 |}
5702 !! result
5703 <table>
5704 <tr>
5705 <td>[[{{{1}}}|{{{2}}}]]
5706 </td></tr></table>
5707
5708 !! end
5709
5710 !! test
5711 Magic variable as template parameter
5712 !! input
5713 {{paramtest|param={{SITENAME}}}}
5714 !! result
5715 <p>This is a test template with parameter MediaWiki
5716 </p>
5717 !! end
5718
5719 !! article
5720 Template:linktest
5721 !! text
5722 [[{{{param}}}|link]]
5723 !! endarticle
5724
5725 !! test
5726 Template parameter as link source
5727 !! input
5728 {{linktest|param=Main Page}}
5729 !! result
5730 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5731 </p>
5732 !! end
5733
5734 !!test
5735 Template-generated attribute string (k='v')
5736 !!input
5737 <span {{attr_str|id|v1}}>bar</span>
5738 !!result
5739 <p><span id="v1">bar</span>
5740 </p>
5741 !!end
5742
5743 !!article
5744 Template:paramtest2
5745 !! text
5746 including another template, {{paramtest|param={{{arg}}}}}
5747 !! endarticle
5748
5749 !! test
5750 Template passing argument to another template
5751 !! input
5752 {{paramtest2|arg='hmm'}}
5753 !! result
5754 <p>including another template, This is a test template with parameter 'hmm'
5755 </p>
5756 !! end
5757
5758 !! article
5759 Template:Linktest2
5760 !! text
5761 Main Page
5762 !! endarticle
5763
5764 !! test
5765 Template as link source
5766 !! input
5767 [[{{linktest2}}]]
5768
5769 [[{{linktest2}}|Main Page]]
5770
5771 [[{{linktest2}}]]Page
5772 !! result
5773 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5774 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5775 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5776 </p>
5777 !! end
5778
5779
5780 !! article
5781 Template:loop1
5782 !! text
5783 {{loop2}}
5784 !! endarticle
5785
5786 !! article
5787 Template:loop2
5788 !! text
5789 {{loop1}}
5790 !! endarticle
5791
5792 !! test
5793 Template infinite loop
5794 !! input
5795 {{loop1}}
5796 !! result
5797 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5798 </p>
5799 !! end
5800
5801 !! test
5802 Template from main namespace
5803 !! input
5804 {{:Main Page}}
5805 !! result
5806 <p>blah blah
5807 </p>
5808 !! end
5809
5810 !! article
5811 Template:table
5812 !! text
5813 {|
5814 | 1 || 2
5815 |-
5816 | 3 || 4
5817 |}
5818 !! endarticle
5819
5820 !! test
5821 BUG 529: Template with table, not included at beginning of line
5822 !! input
5823 foo {{table}}
5824 !! result
5825 <p>foo
5826 </p>
5827 <table>
5828 <tr>
5829 <td> 1 </td>
5830 <td> 2
5831 </td></tr>
5832 <tr>
5833 <td> 3 </td>
5834 <td> 4
5835 </td></tr></table>
5836
5837 !! end
5838
5839 !! test
5840 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5841 !! input
5842 foo
5843 {{table}}
5844 !! result
5845 <p>foo
5846 </p>
5847 <table>
5848 <tr>
5849 <td> 1 </td>
5850 <td> 2
5851 </td></tr>
5852 <tr>
5853 <td> 3 </td>
5854 <td> 4
5855 </td></tr></table>
5856
5857 !! end
5858
5859 !! test
5860 BUG 41: Template parameters shown as broken links
5861 !! input
5862 {{{parameter}}}
5863 !! result
5864 <p>{{{parameter}}}
5865 </p>
5866 !! end
5867
5868 !! test
5869 Template with targets containing wikilinks
5870 !! input
5871 {{[[foo]]}}
5872
5873 {{[[{{echo|foo}}]]}}
5874
5875 {{{{echo|[[foo}}]]}}
5876 !! result
5877 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5878 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5879 </p><p>{{[[foo}}]]
5880 </p>
5881 !! end
5882
5883 !! article
5884 Template:MSGNW test
5885 !! text
5886 ''None'' of '''this''' should be
5887 * interpreted
5888 but rather passed unmodified
5889 {{test}}
5890 !! endarticle
5891
5892 # hmm, fix this or just deprecate msgnw and document its behavior?
5893 !! test
5894 msgnw keyword
5895 !! options
5896 disabled
5897 !! input
5898 {{msgnw:MSGNW test}}
5899 !! result
5900 <p>''None'' of '''this''' should be
5901 * interpreted
5902 but rather passed unmodified
5903 {{test}}
5904 </p>
5905 !! end
5906
5907 !! test
5908 int keyword
5909 !! input
5910 {{int:youhavenewmessages|lots of money|not!}}
5911 !! result
5912 <p>You have lots of money (not!).
5913 </p>
5914 !! end
5915
5916 !! article
5917 Template:Includes
5918 !! text
5919 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5920 !! endarticle
5921
5922 !! test
5923 <includeonly> and <noinclude> being included
5924 !! input
5925 {{Includes}}
5926 !! result
5927 <p>Foobar
5928 </p>
5929 !! end
5930
5931 !! article
5932 Template:Includes2
5933 !! text
5934 <onlyinclude>Foo</onlyinclude>bar
5935 !! endarticle
5936
5937 !! test
5938 <onlyinclude> being included
5939 !! input
5940 {{Includes2}}
5941 !! result
5942 <p>Foo
5943 </p>
5944 !! end
5945
5946
5947 !! article
5948 Template:Includes3
5949 !! text
5950 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5951 !! endarticle
5952
5953 !! test
5954 <onlyinclude> and <includeonly> being included
5955 !! input
5956 {{Includes3}}
5957 !! result
5958 <p>Foo
5959 </p>
5960 !! end
5961
5962 !! test
5963 <includeonly> and <noinclude> on a page
5964 !! input
5965 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5966 !! result
5967 <p>Foozar
5968 </p>
5969 !! end
5970
5971 !! test
5972 Un-closed <noinclude>
5973 !! input
5974 <noinclude>
5975 !! result
5976 !! end
5977
5978 !! test
5979 <onlyinclude> on a page
5980 !! input
5981 <onlyinclude>Foo</onlyinclude>bar
5982 !! result
5983 <p>Foobar
5984 </p>
5985 !! end
5986
5987 !! test
5988 Un-closed <onlyinclude>
5989 !! input
5990 <onlyinclude>
5991 !! result
5992 !! end
5993
5994 !!test
5995 Self-closed noinclude, includeonly, onlyinclude tags
5996 !!input
5997 <noinclude />
5998 <includeonly />
5999 <onlyinclude />
6000 !!result
6001 <p><br />
6002 </p>
6003 !!end
6004
6005 !!test
6006 Unbalanced includeonly and noinclude tags
6007 !!input
6008 {|
6009 |a</noinclude>
6010 |b</noinclude></noinclude>
6011 |c</noinclude></includeonly>
6012 |d</includeonly></includeonly>
6013 |}
6014 !!result
6015 <table>
6016 <tr>
6017 <td>a
6018 </td>
6019 <td>b
6020 </td>
6021 <td>c&lt;/includeonly&gt;
6022 </td>
6023 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6024 </td></tr></table>
6025
6026 !!end
6027
6028 !! article
6029 Template:Includeonly section
6030 !! text
6031 <includeonly>
6032 ==Includeonly section==
6033 </includeonly>
6034 ==Section T-1==
6035 !!endarticle
6036
6037 !! test
6038 Bug 6563: Edit link generation for section shown by <includeonly>
6039 !! input
6040 {{includeonly section}}
6041 !! result
6042 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span></h2>
6043 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span></h2>
6044
6045 !! end
6046
6047 # Uses same input as the contents of [[Template:Includeonly section]]
6048 !! test
6049 Bug 6563: Section extraction for section shown by <includeonly>
6050 !! options
6051 section=T-2
6052 !! input
6053 <includeonly>
6054 ==Includeonly section==
6055 </includeonly>
6056 ==Section T-2==
6057 !! result
6058 ==Section T-2==
6059 !! end
6060
6061 !! test
6062 Bug 6563: Edit link generation for section suppressed by <includeonly>
6063 !! input
6064 <includeonly>
6065 ==Includeonly section==
6066 </includeonly>
6067 ==Section 1==
6068 !! result
6069 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span></h2>
6070
6071 !! end
6072
6073 !! test
6074 Bug 6563: Section extraction for section suppressed by <includeonly>
6075 !! options
6076 section=1
6077 !! input
6078 <includeonly>
6079 ==Includeonly section==
6080 </includeonly>
6081 ==Section 1==
6082 !! result
6083 ==Section 1==
6084 !! end
6085
6086 !! test
6087 Un-closed <includeonly>
6088 !! input
6089 <includeonly>
6090 !! result
6091 !! end
6092
6093 ###
6094 ### <includeonly> and <noinclude> in attributes
6095 ###
6096 !!test
6097 0. includeonly around the entire attribute
6098 !!input
6099 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6100 !!result
6101 <p><span id="v2">bar</span>
6102 </p>
6103 !!end
6104
6105 !!test
6106 1. includeonly in html attr key
6107 !!input
6108 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6109 !!result
6110 <p><span id="foo">bar</span>
6111 </p>
6112 !!end
6113
6114 !!test
6115 2. includeonly in html attr value
6116 !!input
6117 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6118 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6119 !!result
6120 <p><span id="v1">bar</span>
6121 <span id="v1">bar</span>
6122 </p>
6123 !!end
6124
6125 !!test
6126 3. includeonly in part of an attr value
6127 !!input
6128 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6129 !!result
6130 <p><span style="color:red;">bar</span>
6131 </p>
6132 !!end
6133
6134 ###
6135 ### Testing parsing of templates where a template arg
6136 ### has the same name as the template itself.
6137 ###
6138
6139 !! article
6140 Template:quote
6141 !! text
6142 {{{quote|{{{1}}}}}}
6143 !! endarticle
6144
6145 !!test
6146 Templates: Template Name/Arg clash: 1. Use of positional param
6147 !!input
6148 {{quote|foo}}
6149 !!result
6150 <p>foo
6151 </p>
6152 !!end
6153
6154 !!test
6155 Templates: Template Name/Arg clash: 2. Use of named param
6156 !!input
6157 {{quote|quote=foo}}
6158 !!result
6159 <p>foo
6160 </p>
6161 !!end
6162
6163 !!test
6164 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6165 !!input
6166 {{quote|quote}}
6167 !!result
6168 <p>quote
6169 </p>
6170 !!end
6171
6172 ###
6173 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6174 ###
6175
6176 !!test
6177 Templates: 1. Simple use
6178 !!input
6179 {{echo|Foo}}
6180 !!result
6181 <p>Foo
6182 </p>
6183 !!end
6184
6185 !!test
6186 Templates: 2. Inside a block tag
6187 !!input
6188 <div>{{echo|Foo}}</div>
6189 !!result
6190 <div>Foo</div>
6191
6192 !!end
6193
6194 !!test
6195 Templates: P-wrapping: 1a. Templates on consecutive lines
6196 !!input
6197 {{echo|Foo}}
6198 {{echo|bar}}
6199 !!result
6200 <p>Foo
6201 bar
6202 </p>
6203 !!end
6204
6205 !!test
6206 Templates: P-wrapping: 1b. Templates on consecutive lines
6207 !!input
6208 Foo
6209
6210 {{echo|bar}}
6211 {{echo|baz}}
6212 !!result
6213 <p>Foo
6214 </p><p>bar
6215 baz
6216 </p>
6217 !!end
6218
6219 !!test
6220 Templates: P-wrapping: 1c. Templates on consecutive lines
6221 !!input
6222 {{echo|Foo}}
6223 {{echo|bar}} <div>baz</div>
6224 !!result
6225 <p>Foo
6226 </p>
6227 bar <div>baz</div>
6228
6229 !!end
6230
6231 !!test
6232 Templates: P-wrapping: 1d. Template preceded by comment-only line
6233 !!options
6234 parsoid=wt2html,wt2wt
6235 !!input
6236 <!-- foo -->
6237 {{echo|Bar}}
6238 !!result
6239 <!-- foo -->
6240 <p typeof="mw:Object/Template">Bar
6241 </p>
6242 !!end
6243
6244 !!test
6245 Templates: Inline Text: 1. Multiple tmeplate uses
6246 !!input
6247 {{echo|Foo}}bar{{echo|baz}}
6248 !!result
6249 <p>Foobarbaz
6250 </p>
6251 !!end
6252
6253 !!test
6254 Templates: Inline Text: 2. Back-to-back template uses
6255 !!input
6256 {{echo|Foo}}{{echo|bar}}
6257 !!result
6258 <p>Foobar
6259 </p>
6260 !!end
6261
6262 !!test
6263 Templates: Block Tags: 1. Multiple template uses
6264 !!input
6265 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6266 !!result
6267 <div>Foo</div><div>bar</div><div>baz</div>
6268
6269 !!end
6270
6271 !!test
6272 Templates: Block Tags: 2. Back-to-back template uses
6273 !!input
6274 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6275 !!result
6276 <div>Foo</div><div>bar</div>
6277
6278 !!end
6279
6280 !!test
6281 Templates: Links: 1. Simple example
6282 !!input
6283 {{echo|[[Foo|bar]]}}
6284 !!result
6285 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6286 </p>
6287 !!end
6288
6289 !!test
6290 Templates: Links: 2. Generation of link href
6291 !!input
6292 [[{{echo|Foo}}|bar]]
6293 !!result
6294 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6295 </p>
6296 !!end
6297
6298 !!test
6299 Templates: Links: 3. Generation of part of a link href
6300 !!input
6301 [[Fo{{echo|o}}|bar]]
6302
6303 [[Foo{{echo|bar}}]]
6304
6305 [[Foo{{echo|bar}}baz]]
6306
6307 [[Foo{{echo|bar}}|bar]]
6308
6309 [[:Foo{{echo|bar}}]]
6310
6311 [[:Foo{{echo|bar}}|bar]]
6312 !!result
6313 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6314 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6315 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6316 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6317 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6318 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6319 </p>
6320 !!end
6321
6322 !!test
6323 Templates: Links: 4. Multiple templates generating link href
6324 !!input
6325 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6326 !!result
6327 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6328 </p>
6329 !!end
6330
6331 !!test
6332 Templates: Links: 5. Generation of link text
6333 !!input
6334 [[Foo|{{echo|bar}}]]
6335 !!result
6336 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6337 </p>
6338 !!end
6339
6340 !!test
6341 Templates: Links: 5. Nested templates (only outermost template should be marked)
6342 !!input
6343 {{echo|[[{{echo|Foo}}|bar]]}}
6344 !!result
6345 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6346 </p>
6347 !!end
6348
6349 !!test
6350 Templates: HTML Tag: 1. Generation of HTML attr. key
6351 !!input
6352 <div {{echo|style}}="color:red;">foo</div>
6353 !!result
6354 <div style="color:red;">foo</div>
6355
6356 !!end
6357
6358 !!test
6359 Templates: HTML Tag: 2. Generation of HTML attr. value
6360 !!input
6361 <div style={{echo|'color:red;'}}>foo</div>
6362 !!result
6363 <div style="color:red;">foo</div>
6364
6365 !!end
6366
6367 !!test
6368 Templates: HTML Tag: 3. Generation of HTML attr key and value
6369 !!input
6370 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6371 !!result
6372 <div style="color:red;">foo</div>
6373
6374 !!end
6375
6376 !!test
6377 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6378 !!input
6379 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6380 !!result
6381 <div title="This is a long title with just one piece templated">foo</div>
6382
6383 !!end
6384
6385 !!test
6386 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6387 !!input
6388 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6389 !!result
6390 <div title="This is a long title with just one piece templated">foo</div>
6391
6392 !!end
6393
6394 !!test
6395 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6396 !!input
6397 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6398 !!result
6399 <div title="This is a long title with just one piece templated">foo</div>
6400
6401 !!end
6402
6403 !!test
6404 Templates: HTML Tag: 7. Generation of partial attribute key string
6405 !!input
6406 <div st{{echo|yle}}="color:red;">foo</div>
6407 !!result
6408 <div style="color:red;">foo</div>
6409
6410 !!end
6411
6412 !!test
6413 Templates: HTML Tables: 1. Generating start of a HTML table
6414 !!input
6415 {{echo|<table><tr><td>foo</td>}}</tr></table>
6416 !!result
6417 <table><tr><td>foo</td></tr></table>
6418
6419 !!end
6420
6421 !!test
6422 Templates: HTML Tables: 2a. Generating middle of a HTML table
6423 !!input
6424 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6425 !!result
6426 <table><tr><td>foo</td></tr></table>
6427
6428 !!end
6429
6430 !!test
6431 Templates: HTML Tables: 2b. Generating middle of a HTML table
6432 !!input
6433 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6434 !!result
6435 <table><tr><td>foo</td></tr></table>
6436
6437 !!end
6438
6439 !!test
6440 Templates: HTML Tables: 3. Generating end of a HTML table
6441 !!input
6442 <table><tr>{{echo|<td>foo</td></tr></table>}}
6443 !!result
6444 <table><tr><td>foo</td></tr></table>
6445
6446 !!end
6447
6448 !!test
6449 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6450 !!input
6451 {{echo|<table>}}<tr><td>foo</td></tr></table>
6452 !!result
6453 <table><tr><td>foo</td></tr></table>
6454
6455 !!end
6456
6457 !!test
6458 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6459 !!input
6460 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6461 !!result
6462 <table><tr><td>foo</td></tr></table>
6463
6464 !!end
6465
6466 !!test
6467 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6468 !!input
6469 <table><tr>{{echo|<td>}}foo</td></tr></table>
6470 !!result
6471 <table><tr><td>foo</td></tr></table>
6472
6473 !!end
6474
6475 !!test
6476 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6477 !!input
6478 <table><tr><td>foo{{echo|</td>}}</tr></table>
6479 !!result
6480 <table><tr><td>foo</td></tr></table>
6481
6482 !!end
6483
6484 !!test
6485 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6486 !!input
6487 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6488 !!result
6489 <table><tr><td>foo</td></tr></table>
6490
6491 !!end
6492
6493 !!test
6494 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6495 !!input
6496 <table><tr><td>foo</td></tr>{{echo|</table>}}
6497 !!result
6498 <table><tr><td>foo</td></tr></table>
6499
6500 !!end
6501
6502 !!test
6503 Templates: Wiki Tables: 1a. Fostering of entire template content
6504 !!input
6505 {|
6506 {{echo|a}}
6507 |}
6508 !!result
6509 <table>
6510 a
6511 <tr><td></td></tr></table>
6512
6513 !!end
6514
6515 !!test
6516 Templates: Wiki Tables: 1b. Fostering of entire template content
6517 !!input
6518 {|
6519 {{echo|<div>}}
6520 foo
6521 {{echo|</div>}}
6522 |}
6523 !!result
6524 <table>
6525 <div>
6526 <p>foo
6527 </p>
6528 </div>
6529 <tr><td></td></tr></table>
6530
6531 !!end
6532
6533 !!test
6534 Templates: Wiki Tables: 2. Fostering of partial template content
6535 !!input
6536 {|
6537 {{echo|a
6538 <div>b</div>}}
6539 |}
6540 !!result
6541 <table>
6542 a
6543 <div>b</div>
6544 <tr><td></td></tr></table>
6545
6546 !!end
6547
6548 !!test
6549 Templates: Wiki Tables: 3. td-content via multiple templates
6550 !!input
6551 {|
6552 {{echo|{{pipe}}a}}{{echo|b}}
6553 |}
6554 !!result
6555 <table>
6556 <tr>
6557 <td>ab
6558 </td></tr></table>
6559
6560 !!end
6561
6562 !!test
6563 Templates: Wiki Tables: 4. Templated tags, no content
6564 !!input
6565 {{tbl-start}}
6566 {{tbl-end}}
6567 !!result
6568 <table>
6569 <tr><td></td></tr></table>
6570
6571 !!end
6572
6573 !!test
6574 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6575 !!input
6576 {{tbl-start}}
6577 |foo
6578 {{tbl-end}}
6579 !!result
6580 <table>
6581 <tr>
6582 <td>foo
6583 </td></tr></table>
6584
6585 !!end
6586
6587 !!test
6588 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6589 !!input
6590 {{tbl-start}}
6591 {{!}}foo
6592 {{tbl-end}}
6593 !!result
6594 <table>
6595 <tr>
6596 <td>foo
6597 </td></tr></table>
6598
6599 !!end
6600
6601 !!test
6602 Templates: Lists: Multi-line list-items via templates
6603 !!input
6604 *{{echo|a {{nonexistent|
6605 unused}}}}
6606 *{{echo|b {{nonexistent|
6607 unused}}}}
6608 !!result
6609 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
6610 </li><li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
6611 </li></ul>
6612
6613 !!end
6614
6615 !!test
6616 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6617 !!input
6618 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6619 !!result
6620 <p><i>ab</i>c<i>d</i>e
6621 </p>
6622 !!end
6623
6624 !!test
6625 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6626 (PHP parser generates misnested html)
6627 !! options
6628 parsoid=wt2html,wt2wt
6629 !!input
6630 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6631 !!result
6632 <p><span typeof="mw:Object/Template"><i>a</i></span><i typeof="mw:Object/Template"><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6633 !!end
6634
6635 !!test
6636 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6637 (PHP parser generates misnested html)
6638 !! options
6639 parsoid=wt2html,wt2wt
6640 !!input
6641 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6642 !!result
6643 <div typeof="mw:Object/Template"><i>a</i></div>
6644 <div typeof="mw:Object/Template"><i>b</i>c<i>d</i></div>
6645 <div typeof="mw:Object/Template">e</div>
6646 !!end
6647
6648 !!test
6649 Templates: Ugly nesting: 4. Divs opened/closed across templates
6650 !!input
6651 a<div>b{{echo|c</div>d}}e
6652 !!result
6653 a<div>bc</div>de
6654
6655 !!end
6656
6657 !!test
6658 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6659 (Parsoid-centric)
6660 !! options
6661 parsoid
6662 !!input
6663 {|
6664 |{{echo|foo</table>}}
6665 |bar
6666 |}
6667 !!result
6668 <table typeof="mw:Object/Template">
6669 <tbody>
6670 <tr>
6671 <td>foo</td></tr></tbody></table><span>bar</span>
6672 !!end
6673
6674 !!test
6675 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6676 (Parsoid-centric)
6677 !! options
6678 parsoid
6679 !!input
6680 <table>
6681 <tr>
6682 <td>
6683 <table>
6684 <tr>
6685 <td>1. {{echo|foo </table>}}</td>
6686 <td> bar </td>
6687 <td>2. {{echo|baz </table>}}</td>
6688 </tr>
6689 <tr>
6690 <td>abc</td>
6691 </tr>
6692 </table>
6693 </td>
6694 </tr>
6695 <tr>
6696 <td>xyz</td>
6697 </tr>
6698 </table>
6699 !!result
6700 <table about="#mwt1" typeof="mw:Object/Template">
6701 <tbody><tr >
6702 <td >
6703 <table >
6704 <tbody><tr >
6705 <td >1. foo </td></tr></tbody></table></td>
6706 <td > bar </td>
6707 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6708 </span><span about="#mwt1">
6709
6710 abc</span><span about="#mwt1">
6711 </span><span about="#mwt1">
6712 </span><span about="#mwt1">
6713 </span><span about="#mwt1">
6714 </span><span about="#mwt1">
6715
6716 xyz</span><span about="#mwt1">
6717 </span><span about="#mwt1">
6718 </span>
6719 !!end
6720
6721 !! test
6722 Templates: Ugly templates: 3. newline-only template parameter
6723 !! input
6724 foo {{echo|
6725 }}
6726 !! result
6727 <p>foo
6728 </p>
6729 !! end
6730
6731 # This looks like a bug: a single newline triggers p/br for some reason.
6732 !! test
6733 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6734 !! input
6735 {{echo|
6736 }}
6737 !! result
6738 <p><br />
6739 </p>
6740 !! end
6741
6742
6743 !!test
6744 Parser Functions: 1. Simple example
6745 !!input
6746 {{uc:foo}}
6747 !!result
6748 <p>FOO
6749 </p>
6750 !!end
6751
6752 !!test
6753 Parser Functions: 2. Nested use (only outermost should be marked up)
6754 !!input
6755 {{uc:{{lc:FOO}}}}
6756 !!result
6757 <p>FOO
6758 </p>
6759 !!end
6760
6761 ###
6762 ### Pre-save transform tests
6763 ###
6764 !! test
6765 pre-save transform: subst:
6766 !! options
6767 PST
6768 !! input
6769 {{subst:test}}
6770 !! result
6771 This is a test template
6772 !! end
6773
6774 !! test
6775 pre-save transform: normal template
6776 !! options
6777 PST
6778 !! input
6779 {{test}}
6780 !! result
6781 {{test}}
6782 !! end
6783
6784 !! test
6785 pre-save transform: nonexistent template
6786 !! options
6787 PST
6788 !! input
6789 {{thistemplatedoesnotexist}}
6790 !! result
6791 {{thistemplatedoesnotexist}}
6792 !! end
6793
6794
6795 !! test
6796 pre-save transform: subst magic variables
6797 !! options
6798 PST
6799 !! input
6800 {{subst:SITENAME}}
6801 !! result
6802 MediaWiki
6803 !! end
6804
6805 # This is bug 89, which I fixed. -- wtm
6806 !! test
6807 pre-save transform: subst: templates with parameters
6808 !! options
6809 pst
6810 !! input
6811 {{subst:paramtest|param="something else"}}
6812 !! result
6813 This is a test template with parameter "something else"
6814 !! end
6815
6816 !! article
6817 Template:nowikitest
6818 !! text
6819 <nowiki>'''not wiki'''</nowiki>
6820 !! endarticle
6821
6822 !! test
6823 pre-save transform: nowiki in subst (bug 1188)
6824 !! options
6825 pst
6826 !! input
6827 {{subst:nowikitest}}
6828 !! result
6829 <nowiki>'''not wiki'''</nowiki>
6830 !! end
6831
6832
6833 !! article
6834 Template:commenttest
6835 !! text
6836 This template has <!-- a comment --> in it.
6837 !! endarticle
6838
6839 !! test
6840 pre-save transform: comment in subst (bug 1936)
6841 !! options
6842 pst
6843 !! input
6844 {{subst:commenttest}}
6845 !! result
6846 This template has <!-- a comment --> in it.
6847 !! end
6848
6849 !! test
6850 pre-save transform: unclosed tag
6851 !! options
6852 pst noxml
6853 !! input
6854 <nowiki>'''not wiki'''
6855 !! result
6856 <nowiki>'''not wiki'''
6857 !! end
6858
6859 !! test
6860 pre-save transform: mixed tag case
6861 !! options
6862 pst noxml
6863 !! input
6864 <NOwiki>'''not wiki'''</noWIKI>
6865 !! result
6866 <NOwiki>'''not wiki'''</noWIKI>
6867 !! end
6868
6869 !! test
6870 pre-save transform: unclosed comment in <nowiki>
6871 !! options
6872 pst noxml
6873 !! input
6874 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6875 !! result
6876 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6877 !!end
6878
6879 # Leading @ in this template definition works around a limitation
6880 # in parsoid's parserTests which otherwise strips the <span> from the
6881 # result (confusing it for a template wrapper)
6882 !! article
6883 Template:dangerous
6884 !!text
6885 @<span onmouseover="alert('crap')">Oh no</span>
6886 !!endarticle
6887
6888 !!test
6889 (confirming safety of fix for subst bug 1936)
6890 !! input
6891 {{Template:dangerous}}
6892 !! result
6893 <p>@<span>Oh no</span>
6894 </p>
6895 !! end
6896
6897 !! test
6898 pre-save transform: comment containing gallery (bug 5024)
6899 !! options
6900 pst
6901 !! input
6902 <!-- <gallery>data</gallery> -->
6903 !!result
6904 <!-- <gallery>data</gallery> -->
6905 !!end
6906
6907 !! test
6908 pre-save transform: comment containing extension
6909 !! options
6910 pst
6911 !! input
6912 <!-- <tag>data</tag> -->
6913 !!result
6914 <!-- <tag>data</tag> -->
6915 !!end
6916
6917 !! test
6918 pre-save transform: comment containing nowiki
6919 !! options
6920 pst
6921 !! input
6922 <!-- <nowiki>data</nowiki> -->
6923 !!result
6924 <!-- <nowiki>data</nowiki> -->
6925 !!end
6926
6927 !! test
6928 pre-save transform: <noinclude> in subst (bug 3298)
6929 !! options
6930 pst
6931 !! input
6932 {{subst:Includes}}
6933 !! result
6934 Foobar
6935 !! end
6936
6937 !! test
6938 pre-save transform: <onlyinclude> in subst (bug 3298)
6939 !! options
6940 pst
6941 !! input
6942 {{subst:Includes2}}
6943 !! result
6944 Foo
6945 !! end
6946
6947 !! article
6948 Template:SubstTest
6949 !!text
6950 {{<includeonly>subst:</includeonly>Includes}}
6951 !! endarticle
6952
6953 !! article
6954 Template:SafeSubstTest
6955 !! text
6956 {{<includeonly>safesubst:</includeonly>Includes}}
6957 !! endarticle
6958
6959 !! test
6960 bug 22297: safesubst: works during PST
6961 !! options
6962 pst
6963 !! input
6964 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6965 !! result
6966 FoobarFoobar
6967 !! end
6968
6969 !! test
6970 bug 22297: safesubst: works during normal parse
6971 !! input
6972 {{SafeSubstTest}}
6973 !! result
6974 <p>Foobar
6975 </p>
6976 !! end
6977
6978 !! test:
6979 subst: does not work during normal parse
6980 !! input
6981 {{SubstTest}}
6982 !! result
6983 <p>{{subst:Includes}}
6984 </p>
6985 !! end
6986
6987 !! test
6988 pre-save transform: context links ("pipe trick")
6989 !! options
6990 pst
6991 !! input
6992 [[Article (context)|]]
6993 [[Bar:Article|]]
6994 [[:Bar:Article|]]
6995 [[Bar:Article (context)|]]
6996 [[:Bar:Article (context)|]]
6997 [[|Article]]
6998 [[|Article (context)]]
6999 [[Bar:X (Y) Z|]]
7000 [[:Bar:X (Y) Z|]]
7001 !! result
7002 [[Article (context)|Article]]
7003 [[Bar:Article|Article]]
7004 [[:Bar:Article|Article]]
7005 [[Bar:Article (context)|Article]]
7006 [[:Bar:Article (context)|Article]]
7007 [[Article]]
7008 [[Article (context)]]
7009 [[Bar:X (Y) Z|X (Y) Z]]
7010 [[:Bar:X (Y) Z|X (Y) Z]]
7011 !! end
7012
7013 !! test
7014 pre-save transform: context links ("pipe trick") with interwiki prefix
7015 !! options
7016 pst
7017 !! input
7018 [[interwiki:Article|]]
7019 [[:interwiki:Article|]]
7020 [[interwiki:Bar:Article|]]
7021 [[:interwiki:Bar:Article|]]
7022 !! result
7023 [[interwiki:Article|Article]]
7024 [[:interwiki:Article|Article]]
7025 [[interwiki:Bar:Article|Bar:Article]]
7026 [[:interwiki:Bar:Article|Bar:Article]]
7027 !! end
7028
7029 !! test
7030 pre-save transform: context links ("pipe trick") with parens in title
7031 !! options
7032 pst title=[[Somearticle (context)]]
7033 !! input
7034 [[|Article]]
7035 !! result
7036 [[Article (context)|Article]]
7037 !! end
7038
7039 !! test
7040 pre-save transform: context links ("pipe trick") with comma in title
7041 !! options
7042 pst title=[[Someplace, Somewhere]]
7043 !! input
7044 [[|Otherplace]]
7045 [[Otherplace, Elsewhere|]]
7046 [[Otherplace, Elsewhere, Anywhere|]]
7047 !! result
7048 [[Otherplace, Somewhere|Otherplace]]
7049 [[Otherplace, Elsewhere|Otherplace]]
7050 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7051 !! end
7052
7053 !! test
7054 pre-save transform: context links ("pipe trick") with parens and comma
7055 !! options
7056 pst title=[[Someplace (IGNORED), Somewhere]]
7057 !! input
7058 [[|Otherplace]]
7059 [[Otherplace (place), Elsewhere|]]
7060 !! result
7061 [[Otherplace, Somewhere|Otherplace]]
7062 [[Otherplace (place), Elsewhere|Otherplace]]
7063 !! end
7064
7065 !! test
7066 pre-save transform: context links ("pipe trick") with comma and parens
7067 !! options
7068 pst title=[[Who, me? (context)]]
7069 !! input
7070 [[|Yes, you.]]
7071 [[Me, Myself, and I (1937 song)|]]
7072 !! result
7073 [[Yes, you. (context)|Yes, you.]]
7074 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7075 !! end
7076
7077 !! test
7078 pre-save transform: context links ("pipe trick") with namespace
7079 !! options
7080 pst title=[[Ns:Somearticle]]
7081 !! input
7082 [[|Article]]
7083 !! result
7084 [[Ns:Article|Article]]
7085 !! end
7086
7087 !! test
7088 pre-save transform: context links ("pipe trick") with namespace and parens
7089 !! options
7090 pst title=[[Ns:Somearticle (context)]]
7091 !! input
7092 [[|Article]]
7093 !! result
7094 [[Ns:Article (context)|Article]]
7095 !! end
7096
7097 !! test
7098 pre-save transform: context links ("pipe trick") with namespace and comma
7099 !! options
7100 pst title=[[Ns:Somearticle, Context, Whatever]]
7101 !! input
7102 [[|Article]]
7103 !! result
7104 [[Ns:Article, Context, Whatever|Article]]
7105 !! end
7106
7107 !! test
7108 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7109 !! options
7110 pst title=[[Ns:Somearticle, Context (context)]]
7111 !! input
7112 [[|Article]]
7113 !! result
7114 [[Ns:Article (context)|Article]]
7115 !! end
7116
7117 !! test
7118 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7119 !! options
7120 pst title=[[Ns:Somearticle (IGNORED), Context]]
7121 !! input
7122 [[|Article]]
7123 !! result
7124 [[Ns:Article, Context|Article]]
7125 !! end
7126
7127 !! test
7128 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7129 !! options
7130 pst
7131 !! input
7132 [[Article(context)|]]
7133 [[Bar:Article(context)|]]
7134 [[:Bar:Article(context)|]]
7135 [[|Article(context)]]
7136 [[Bar:X(Y)Z|]]
7137 [[:Bar:X(Y)Z|]]
7138 !! result
7139 [[Article(context)|Article]]
7140 [[Bar:Article(context)|Article]]
7141 [[:Bar:Article(context)|Article]]
7142 [[Article(context)]]
7143 [[Bar:X(Y)Z|X(Y)Z]]
7144 [[:Bar:X(Y)Z|X(Y)Z]]
7145 !! end
7146
7147 !! test
7148 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7149 !! options
7150 pst
7151 !! input
7152 [[Article (context)|]]
7153 [[Bar:Article (context)|]]
7154 [[:Bar:Article (context)|]]
7155 [[|Article (context)]]
7156 [[Bar:X (Y) Z|]]
7157 [[:Bar:X (Y) Z|]]
7158 !! result
7159 [[Article (context)|Article]]
7160 [[Bar:Article (context)|Article]]
7161 [[:Bar:Article (context)|Article]]
7162 [[Article (context)]]
7163 [[Bar:X (Y) Z|X (Y) Z]]
7164 [[:Bar:X (Y) Z|X (Y) Z]]
7165 !! end
7166
7167 !! test
7168 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7169 !! options
7170 pst
7171 !! input
7172 [[Article(context)|]]
7173 [[Bar:Article(context)|]]
7174 [[:Bar:Article(context)|]]
7175 [[|Article(context)]]
7176 [[Bar:X(Y)Z|]]
7177 [[:Bar:X(Y)Z|]]
7178 !! result
7179 [[Article(context)|Article]]
7180 [[Bar:Article(context)|Article]]
7181 [[:Bar:Article(context)|Article]]
7182 [[Article(context)]]
7183 [[Bar:X(Y)Z|X(Y)Z]]
7184 [[:Bar:X(Y)Z|X(Y)Z]]
7185 !! end
7186
7187 !! test
7188 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7189 !! options
7190 pst
7191 !! input
7192 [[Article (context), context|]]
7193 [[Article (context),context|]]
7194 [[Bar:Article (context), context|]]
7195 [[Bar:Article (context),context|]]
7196 [[:Bar:Article (context), context|]]
7197 [[:Bar:Article (context),context|]]
7198 !! result
7199 [[Article (context), context|Article]]
7200 [[Article (context),context|Article]]
7201 [[Bar:Article (context), context|Article]]
7202 [[Bar:Article (context),context|Article]]
7203 [[:Bar:Article (context), context|Article]]
7204 [[:Bar:Article (context),context|Article]]
7205 !! end
7206
7207 !! test
7208 pre-save transform: trim trailing empty lines
7209 !! options
7210 pst
7211 !! input
7212 Empty lines are trimmed
7213
7214
7215
7216
7217 !! result
7218 Empty lines are trimmed
7219 !! end
7220
7221 !! test
7222 pre-save transform: Signature expansion
7223 !! options
7224 pst
7225 !! input
7226 * ~~~
7227 * <noinclude>~~~</noinclude>
7228 * <includeonly>~~~</includeonly>
7229 * <onlyinclude>~~~</onlyinclude>
7230 !! result
7231 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7232 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7233 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7234 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7235 !! end
7236
7237
7238 !! test
7239 pre-save transform: Signature expansion in nowiki tags (bug 93)
7240 !! options
7241 pst disabled
7242 !! input
7243 Shall not expand:
7244
7245 <nowiki>~~~~</nowiki>
7246
7247 <includeonly><nowiki>~~~~</nowiki></includeonly>
7248
7249 <noinclude><nowiki>~~~~</nowiki></noinclude>
7250
7251 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7252
7253 {{subst:Foo}} shall be converted to FOO
7254
7255 As well as inside noinclude/onlyinclude
7256 <noinclude>{{subst:Foo}}</noinclude>
7257 <onlyinclude>{{subst:Foo}}</onlyinclude>
7258
7259 But not inside includeonly
7260 <includeonly>{{subst:Foo}}</includeonly>
7261 !! result
7262 Shall not expand:
7263
7264 <nowiki>~~~~</nowiki>
7265
7266 <includeonly><nowiki>~~~~</nowiki></includeonly>
7267
7268 <noinclude><nowiki>~~~~</nowiki></noinclude>
7269
7270 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7271
7272 FOO shall be converted to FOO
7273
7274 As well as inside noinclude/onlyinclude
7275 <noinclude>FOO</noinclude>
7276 <onlyinclude>FOO</onlyinclude>
7277
7278 But not inside includeonly
7279 <includeonly>{{subst:Foo}}</includeonly>
7280 !! end
7281
7282 ###
7283 ### Message transform tests
7284 ###
7285 !! test
7286 message transform: magic variables
7287 !! options
7288 msg
7289 !! input
7290 {{SITENAME}}
7291 !! result
7292 MediaWiki
7293 !! end
7294
7295 !! test
7296 message transform: should not transform wiki markup
7297 !! options
7298 msg
7299 !! input
7300 ''test''
7301 !! result
7302 ''test''
7303 !! end
7304
7305 !! test
7306 message transform: <noinclude> in transcluded template (bug 4926)
7307 !! options
7308 msg
7309 !! input
7310 {{Includes}}
7311 !! result
7312 Foobar
7313 !! end
7314
7315 !! test
7316 message transform: <onlyinclude> in transcluded template (bug 4926)
7317 !! options
7318 msg
7319 !! input
7320 {{Includes2}}
7321 !! result
7322 Foo
7323 !! end
7324
7325 !! test
7326 {{#special:}} page name, known
7327 !! options
7328 msg
7329 !! input
7330 {{#special:Recentchanges}}
7331 !! result
7332 Special:RecentChanges
7333 !! end
7334
7335 !! test
7336 {{#special:}} page name with subpage, known
7337 !! options
7338 msg
7339 !! input
7340 {{#special:Recentchanges/param}}
7341 !! result
7342 Special:RecentChanges/param
7343 !! end
7344
7345 !! test
7346 {{#special:}} page name, unknown
7347 !! options
7348 msg
7349 !! input
7350 {{#special:foobarnonexistent}}
7351 !! result
7352 No such special page
7353 !! end
7354
7355 !! test
7356 {{#speciale:}} page name, known
7357 !! options
7358 msg
7359 !! input
7360 {{#speciale:Recentchanges}}
7361 !! result
7362 Special:RecentChanges
7363 !! end
7364
7365 !! test
7366 {{#speciale:}} page name with subpage, known
7367 !! options
7368 msg
7369 !! input
7370 {{#speciale:Recentchanges/param}}
7371 !! result
7372 Special:RecentChanges/param
7373 !! end
7374
7375 !! test
7376 {{#speciale:}} page name, unknown
7377 !! options
7378 msg
7379 !! input
7380 {{#speciale:foobarnonexistent}}
7381 !! result
7382 No_such_special_page
7383 !! end
7384
7385 ###
7386 ### Images
7387 ###
7388 !! test
7389 Simple image
7390 !! input
7391 [[Image:foobar.jpg]]
7392 !! result
7393 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7394 </p>
7395 !! end
7396
7397 !! test
7398 Right-aligned image
7399 !! input
7400 [[Image:foobar.jpg|right]]
7401 !! result
7402 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7403
7404 !! end
7405
7406 !! test
7407 Simple image (using File: namespace, now canonical)
7408 !! input
7409 [[File:foobar.jpg]]
7410 !! result
7411 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7412 </p>
7413 !! end
7414
7415 !! test
7416 Image with caption
7417 !! input
7418 [[Image:foobar.jpg|right|Caption text]]
7419 !! result
7420 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7421
7422 !! end
7423
7424 !! test
7425 Image with empty attribute
7426 !! input
7427 [[Image:foobar.jpg|right||Caption text]]
7428 !! result
7429 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7430
7431 !! end
7432
7433 !! test
7434 Image with link tails
7435 !! input
7436 123[[Image:foobar.jpg]]456
7437 123[[Image:foobar.jpg|right]]456
7438 123[[Image:foobar.jpg|thumb]]456
7439 !! result
7440 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
7441 </p>
7442 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
7443 123<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
7444
7445 !! end
7446
7447 !! test
7448 Image with multiple captions -- only last one is accepted
7449 !! input
7450 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7451 !! result
7452 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7453
7454 !! end
7455
7456 !! test
7457 Image with width attribute at different positions
7458 !! input
7459 [[Image:foobar.jpg|200px|right|Caption]]
7460 [[Image:foobar.jpg|right|200px|Caption]]
7461 [[Image:foobar.jpg|right|Caption|200px]]
7462 !! result
7463 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7464 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7465 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7466
7467 !! end
7468
7469 !! test
7470 Image with link parameter, wiki target
7471 !! input
7472 [[Image:foobar.jpg|link=Target page]]
7473 !! result
7474 <p><a href="/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7475 </p>
7476 !! end
7477
7478 !! test
7479 Image with link parameter, URL target
7480 !! input
7481 [[Image:foobar.jpg|link=http://example.com/]]
7482 !! result
7483 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7484 </p>
7485 !! end
7486
7487 !! test
7488 Image with link parameter, wgExternalLinkTarget
7489 !! input
7490 [[Image:foobar.jpg|link=http://example.com/]]
7491 !! config
7492 wgExternalLinkTarget='foobar'
7493 !! result
7494 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7495 </p>
7496 !! end
7497
7498 !! test
7499 Image with link parameter, wgNoFollowLinks set to false
7500 !! input
7501 [[Image:foobar.jpg|link=http://example.com/]]
7502 !! config
7503 wgNoFollowLinks=false
7504 !! result
7505 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7506 </p>
7507 !! end
7508
7509 !! test
7510 Image with link parameter, wgNoFollowDomainExceptions
7511 !! input
7512 [[Image:foobar.jpg|link=http://example.com/]]
7513 !! config
7514 wgNoFollowDomainExceptions='example.com'
7515 !! result
7516 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7517 </p>
7518 !! end
7519
7520 !! test
7521 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7522 !! input
7523 [[Image:foobar.jpg|link=http://example.com/|Title]]
7524 !! config
7525 wgExternalLinkTarget='foobar'
7526 !! result
7527 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7528 </p>
7529 !! end
7530
7531 !! test
7532 Image with empty link parameter
7533 !! input
7534 [[Image:foobar.jpg|link=]]
7535 !! result
7536 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7537 </p>
7538 !! end
7539
7540 !! test
7541 Image with link parameter (wiki target) and unnamed parameter
7542 !! input
7543 [[Image:foobar.jpg|link=Target page|Title]]
7544 !! result
7545 <p><a href="/wiki/Target_page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7546 </p>
7547 !! end
7548
7549 !! test
7550 Image with link parameter (URL target) and unnamed parameter
7551 !! input
7552 [[Image:foobar.jpg|link=http://example.com/|Title]]
7553 !! result
7554 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7555 </p>
7556 !! end
7557
7558 !! test
7559 Thumbnail image with link parameter
7560 !! options
7561 php
7562 !! input
7563 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7564 !! result
7565 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7566
7567 !! end
7568
7569 !! test
7570 Manually-specified thumbnail image
7571 !! options
7572 php
7573 !! input
7574 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7575 !! result
7576 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7577
7578 !! end
7579
7580 !! test
7581 Manually-specified thumbnail image with explicit link to wiki page
7582 !! options
7583 php
7584 !! input
7585 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7586 !! result
7587 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7588
7589 !! end
7590
7591 !! test
7592 Manually-specified thumbnail image with explicit link to url
7593 !! options
7594 php
7595 !! input
7596 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7597 !! result
7598 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7599
7600 !! end
7601
7602 !! test
7603 Manually-specified thumbnail image with explicit no link
7604 !! options
7605 php
7606 !! input
7607 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7608 !! result
7609 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7610
7611 !! end
7612
7613 !! test
7614 Manually-specified thumbnail image with explicit link and alt text
7615 !! options
7616 php
7617 !! input
7618 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7619 !! result
7620 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7621
7622 !! end
7623
7624 !! test
7625 Image with frame and link
7626 !! input
7627 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7628 !! result
7629 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
7630
7631 !! end
7632
7633 !! test
7634 Image with frame and link and explicit alt
7635 !! input
7636 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7637 !! result
7638 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
7639
7640 !! end
7641
7642 !! test
7643 Image with wiki markup in implicit alt
7644 !! input
7645 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7646 !! result
7647 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7648 </p>
7649 !! end
7650
7651 !! test
7652 Image with wiki markup in explicit alt
7653 !! input
7654 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7655 !! result
7656 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7657 </p>
7658 !! end
7659
7660 !! test
7661 Link to image page- image page normally doesn't exists, hence edit link
7662 Add test with existing image page
7663 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7664 !! input
7665 [[:Image:test]]
7666 !! result
7667 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
7668 </p>
7669 !! end
7670
7671 !! test
7672 bug 18784 Link to non-existent image page with caption should use caption as link text
7673 !! input
7674 [[:Image:test|caption]]
7675 !! result
7676 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
7677 </p>
7678 !! end
7679
7680 !! test
7681 Frameless image caption with a free URL
7682 !! input
7683 [[Image:foobar.jpg|http://example.com]]
7684 !! result
7685 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7686 </p>
7687 !! end
7688
7689 !! test
7690 Thumbnail image caption with a free URL
7691 !! input
7692 [[Image:foobar.jpg|thumb|http://example.com]]
7693 !! result
7694 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
7695
7696 !! end
7697
7698 !! test
7699 Thumbnail image caption with a free URL and explicit alt
7700 !! input
7701 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7702 !! result
7703 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
7704
7705 !! end
7706
7707 !! test
7708 BUG 1887: A ISBN with a thumbnail
7709 !! input
7710 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7711 !! result
7712 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
7713
7714 !! end
7715
7716 !! test
7717 BUG 1887: A RFC with a thumbnail
7718 !! input
7719 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7720 !! result
7721 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
7722
7723 !! end
7724
7725 !! test
7726 BUG 1887: A mailto link with a thumbnail
7727 !! input
7728 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7729 !! result
7730 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
7731
7732 !! end
7733
7734 # Pending resolution to bug 368
7735 !! test
7736 BUG 648: Frameless image caption with a link
7737 !! input
7738 [[Image:foobar.jpg|text with a [[link]] in it]]
7739 !! result
7740 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7741 </p>
7742 !! end
7743
7744 !! test
7745 BUG 648: Frameless image caption with a link (suffix)
7746 !! input
7747 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7748 !! result
7749 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7750 </p>
7751 !! end
7752
7753 !! test
7754 BUG 648: Frameless image caption with an interwiki link
7755 !! input
7756 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7757 !! result
7758 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7759 </p>
7760 !! end
7761
7762 !! test
7763 BUG 648: Frameless image caption with a piped interwiki link
7764 !! input
7765 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7766 !! result
7767 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7768 </p>
7769 !! end
7770
7771 !! test
7772 Escape HTML special chars in image alt text
7773 !! input
7774 [[Image:foobar.jpg|& < > "]]
7775 !! result
7776 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7777 </p>
7778 !! end
7779
7780 !! test
7781 BUG 499: Alt text should have &#1234;, not &amp;1234;
7782 !! input
7783 [[Image:foobar.jpg|&#9792;]]
7784 !! result
7785 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7786 </p>
7787 !! end
7788
7789 !! test
7790 Broken image caption with link
7791 !! input
7792 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7793 !! result
7794 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
7795 </p>
7796 !! end
7797
7798 !! test
7799 Image caption containing another image
7800 !! input
7801 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7802 !! result
7803 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="File:Icon.png">image</a> inside it!</div></div></div>
7804
7805 !! end
7806
7807 !! test
7808 Image caption containing a newline
7809 !! input
7810 [[Image:Foobar.jpg|This
7811 *is some text]]
7812 !! result
7813 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7814 </p>
7815 !!end
7816
7817 !!test
7818 Parsoid: Image caption containing leading space
7819 (The leading space should not trigger nowiki escaping in wt2wt mode)
7820 !! input
7821 [[Image:Foobar.jpg|thumb| bar]]
7822 !! result
7823 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>bar</div></div></div>
7824
7825 !!end
7826
7827 !! test
7828 Bug 3090: External links other than http: in image captions
7829 !! input
7830 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7831 !! result
7832 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
7833
7834 !! end
7835
7836 !! test
7837 Custom class
7838 !! input
7839 [[Image:foobar.jpg|a|class=b]]
7840 !! result
7841 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
7842 </p>
7843 !! end
7844
7845 !! test
7846 Localized image handling (1).
7847 !! options
7848 language=es
7849 !! input
7850 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7851 !! result
7852 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7853
7854 !! end
7855
7856 !! test
7857 Localized image handling (2).
7858 !! options
7859 language=es
7860 !! input
7861 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7862 !! result
7863 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
7864
7865 !! end
7866
7867 !! test
7868 "border", "frameless" and "class" attributes on an image.
7869 !! input
7870 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7871 !! result
7872 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
7873 </p>
7874 !! end
7875
7876 !! article
7877 File:Barfoo.jpg
7878 !! text
7879 #REDIRECT [[File:Barfoo.jpg]]
7880 !! endarticle
7881
7882 !! test
7883 Redirected image
7884 !! input
7885 [[Image:Barfoo.jpg]]
7886 !! result
7887 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7888 </p>
7889 !! end
7890
7891 !! test
7892 Missing image with uploads disabled
7893 !! options
7894 wgEnableUploads=0
7895 !! input
7896 [[Image:Foobaz.jpg]]
7897 !! result
7898 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7899 </p>
7900 !! end
7901
7902
7903 ###
7904 ### Subpages
7905 ###
7906 !! article
7907 Subpage test/subpage
7908 !! text
7909 foo
7910 !! endarticle
7911
7912 !! test
7913 Subpage link
7914 !! options
7915 subpage title=[[Subpage test]]
7916 !! input
7917 [[/subpage]]
7918 !! result
7919 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7920 </p>
7921 !! end
7922
7923 !! test
7924 Subpage noslash link
7925 !! options
7926 subpage title=[[Subpage test]]
7927 !!input
7928 [[/subpage/]]
7929 !! result
7930 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7931 </p>
7932 !! end
7933
7934 !! test
7935 Disabled subpages
7936 !! input
7937 [[/subpage]]
7938 !! result
7939 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7940 </p>
7941 !! end
7942
7943 !! test
7944 BUG 561: {{/Subpage}}
7945 !! options
7946 subpage title=[[Page]]
7947 !! input
7948 {{/Subpage}}
7949 !! result
7950 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
7951 </p>
7952 !! end
7953
7954 ###
7955 ### Categories
7956 ###
7957 !! article
7958 Category:MediaWiki User's Guide
7959 !! text
7960 blah
7961 !! endarticle
7962
7963 !! test
7964 Link to category
7965 !! input
7966 [[:Category:MediaWiki User's Guide]]
7967 !! result
7968 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7969 </p>
7970 !! end
7971
7972 !! test
7973 Simple category
7974 !! options
7975 cat
7976 !! input
7977 [[Category:MediaWiki User's Guide]]
7978 !! result
7979 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7980 !! end
7981
7982 !! test
7983 PAGESINCATEGORY invalid title fatal (r33546 fix)
7984 !! input
7985 {{PAGESINCATEGORY:<bogus>}}
7986 !! result
7987 <p>0
7988 </p>
7989 !! end
7990
7991 !! test
7992 Category with different sort key
7993 !! options
7994 cat
7995 !! input
7996 [[Category:MediaWiki User's Guide|Foo]]
7997 !! result
7998 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7999 !! end
8000
8001 !! test
8002 Category with identical sort key
8003 !! options
8004 cat
8005 !! input
8006 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8007 !! result
8008 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
8009 !! end
8010
8011 !! test
8012 Category with empty sort key
8013 !! options
8014 cat
8015 pst
8016 !! input
8017 [[Category:MediaWiki User's Guide|]]
8018 !! result
8019 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
8020 !! end
8021
8022 !! test
8023 Category with empty sort key and parentheses
8024 !! options
8025 cat
8026 pst
8027 !! input
8028 [[Category:Foo (bar)|]]
8029 !! result
8030 [[Category:Foo (bar)|Foo]]
8031 !! end
8032
8033 !! test
8034 Category with link tail
8035 !! options
8036 cat
8037 pst
8038 !! input
8039 123[[Category:Foo]]456
8040 !! result
8041 123[[Category:Foo]]456
8042 !! end
8043
8044 !! test
8045 Category with template
8046 !! options
8047 cat
8048 pst
8049 !! input
8050 [[Category:{{echo|Foo}}]]
8051 !! result
8052 [[Category:{{echo|Foo}}]]
8053 !! end
8054
8055 !! test
8056 Category with template in sort key
8057 !! options
8058 cat
8059 pst
8060 !! input
8061 [[Category:Foo|{{echo|Bar}}]]
8062 !! result
8063 [[Category:Foo|{{echo|Bar}}]]
8064 !! end
8065
8066 !! test
8067 Category with template in sort key and title
8068 !! options
8069 cat
8070 pst
8071 !! input
8072 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8073 !! result
8074 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8075 !! end
8076
8077 !! test
8078 Category / paragraph interactions
8079 !! input
8080 Foo [[Category:Baz]] Bar
8081
8082 Foo [[Category:Baz]]
8083 Bar
8084
8085 Foo
8086 [[Category:Baz]]
8087 Bar
8088
8089 Foo
8090 [[Category:Baz]] Bar
8091
8092 Foo
8093 [[Category:Baz]]
8094 [[Category:Baz]]
8095 [[Category:Baz]]
8096 Bar
8097
8098 [[Category:Baz]]
8099 [[Category:Baz]]
8100 [[Category:Baz]]
8101
8102 [[Category:Baz]]
8103 {{echo|[[Category:Baz]]}}
8104 [[Category:Baz]]
8105 !! result
8106 <p>Foo Bar
8107 </p><p>Foo
8108 Bar
8109 </p><p>Foo
8110 Bar
8111 </p><p>Foo Bar
8112 </p><p>Foo
8113 Bar
8114 </p>
8115 !! end
8116
8117 ###
8118 ### Inter-language links
8119 ###
8120 !! test
8121 Inter-language links
8122 !! options
8123 ill
8124 !! input
8125 [[es:Alimento]]
8126 [[fr:Nourriture]]
8127 [[zh:&#39135;&#21697;]]
8128 !! result
8129 es:Alimento fr:Nourriture zh:食品
8130 !! end
8131
8132 !! test
8133 Duplicate interlanguage links (bug 24502)
8134 !! options
8135 ill
8136 !! input
8137 [[es:1]]
8138 [[es:2]]
8139 [[fr:1]]
8140 [[fr:2]]
8141 !! result
8142 es:1 fr:1
8143 !! end
8144
8145 ###
8146 ### Sections
8147 ###
8148 !! test
8149 Basic section headings
8150 !! input
8151 == Headline 1 ==
8152 Some text
8153
8154 ==Headline 2==
8155 More
8156 ===Smaller headline===
8157 Blah blah
8158 !! result
8159 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span></h2>
8160 <p>Some text
8161 </p>
8162 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span></h2>
8163 <p>More
8164 </p>
8165 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span></h3>
8166 <p>Blah blah
8167 </p>
8168 !! end
8169
8170 !! test
8171 Section headings with TOC
8172 !! input
8173 == Headline 1 ==
8174 === Subheadline 1 ===
8175 ===== Skipping a level =====
8176 ====== Skipping a level ======
8177
8178 == Headline 2 ==
8179 Some text
8180 ===Another headline===
8181 !! result
8182 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8183 <ul>
8184 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8185 <ul>
8186 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8187 <ul>
8188 <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
8189 <ul>
8190 <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
8191 </ul>
8192 </li>
8193 </ul>
8194 </li>
8195 </ul>
8196 </li>
8197 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8198 <ul>
8199 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8200 </ul>
8201 </li>
8202 </ul>
8203 </td></tr></table>
8204 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span></h2>
8205 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span></h3>
8206 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span></h5>
8207 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span></h6>
8208 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span></h2>
8209 <p>Some text
8210 </p>
8211 <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span></h3>
8212
8213 !! end
8214
8215 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8216 !! test
8217 Handling of sections up to level 6 and beyond
8218 !! input
8219 = Level 1 Heading=
8220 == Level 2 Heading==
8221 === Level 3 Heading===
8222 ==== Level 4 Heading====
8223 ===== Level 5 Heading=====
8224 ====== Level 6 Heading======
8225 ======= Level 7 Heading=======
8226 ======== Level 8 Heading========
8227 ========= Level 9 Heading=========
8228 ========== Level 10 Heading==========
8229 !! result
8230 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8231 <ul>
8232 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8233 <ul>
8234 <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
8235 <ul>
8236 <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
8237 <ul>
8238 <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
8239 <ul>
8240 <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
8241 <ul>
8242 <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
8243 <li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
8244 <li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
8245 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
8246 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
8247 </ul>
8248 </li>
8249 </ul>
8250 </li>
8251 </ul>
8252 </li>
8253 </ul>
8254 </li>
8255 </ul>
8256 </li>
8257 </ul>
8258 </td></tr></table>
8259 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span></h1>
8260 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span></h2>
8261 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span></h3>
8262 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span></h4>
8263 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span></h5>
8264 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span></h6>
8265 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span></h6>
8266 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span></h6>
8267 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span></h6>
8268 <h6><span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span></h6>
8269
8270 !! end
8271
8272 !! test
8273 TOC regression (bug 9764)
8274 !! input
8275 == title 1 ==
8276 === title 1.1 ===
8277 ==== title 1.1.1 ====
8278 === title 1.2 ===
8279 == title 2 ==
8280 === title 2.1 ===
8281 !! result
8282 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8283 <ul>
8284 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8285 <ul>
8286 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
8287 <ul>
8288 <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
8289 </ul>
8290 </li>
8291 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
8292 </ul>
8293 </li>
8294 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8295 <ul>
8296 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
8297 </ul>
8298 </li>
8299 </ul>
8300 </td></tr></table>
8301 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8302 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8303 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span></h4>
8304 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span></h3>
8305 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span></h2>
8306 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span></h3>
8307
8308 !! end
8309
8310 !! test
8311 TOC with wgMaxTocLevel=3 (bug 6204)
8312 !! options
8313 wgMaxTocLevel=3
8314 !! input
8315 == title 1 ==
8316 === title 1.1 ===
8317 ==== title 1.1.1 ====
8318 === title 1.2 ===
8319 == title 2 ==
8320 === title 2.1 ===
8321 !! result
8322 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8323 <ul>
8324 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8325 <ul>
8326 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
8327 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
8328 </ul>
8329 </li>
8330 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8331 <ul>
8332 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
8333 </ul>
8334 </li>
8335 </ul>
8336 </td></tr></table>
8337 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8338 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8339 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span></h4>
8340 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span></h3>
8341 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span></h2>
8342 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span></h3>
8343
8344 !! end
8345
8346 !! test
8347 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8348 !! options
8349 wgMaxTocLevel=3
8350 !! input
8351 ==Section 1==
8352 ===Section 1.1===
8353 ====Section 1.1.1====
8354 ====Section 1.1.1.1====
8355 ==Section 2==
8356 !! result
8357 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8358 <ul>
8359 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8360 <ul>
8361 <li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
8362 </ul>
8363 </li>
8364 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8365 </ul>
8366 </td></tr></table>
8367 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span></h2>
8368 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a>]</span></h3>
8369 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a>]</span></h4>
8370 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a>]</span></h4>
8371 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a>]</span></h2>
8372
8373 !! end
8374
8375
8376 !! test
8377 Resolving duplicate section names
8378 !! input
8379 == Foo bar ==
8380 == Foo bar ==
8381 !! result
8382 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span></h2>
8383 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span></h2>
8384
8385 !! end
8386
8387 !! test
8388 Resolving duplicate section names with differing case (bug 10721)
8389 !! input
8390 == Foo bar ==
8391 == Foo Bar ==
8392 !! result
8393 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span></h2>
8394 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span></h2>
8395
8396 !! end
8397
8398 !! article
8399 Template:sections
8400 !! text
8401 ===Section 1===
8402 ==Section 2==
8403 !! endarticle
8404
8405 !! test
8406 Template with sections, __NOTOC__
8407 !! input
8408 __NOTOC__
8409 ==Section 0==
8410 {{sections}}
8411 ==Section 4==
8412 !! result
8413 <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span></h2>
8414 <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span></h3>
8415 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span></h2>
8416 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span></h2>
8417
8418 !! end
8419
8420 !! test
8421 __NOEDITSECTION__ keyword
8422 !! input
8423 __NOEDITSECTION__
8424 ==Section 1==
8425 ==Section 2==
8426 !! result
8427 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
8428 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
8429
8430 !! end
8431
8432 !! test
8433 Link inside a section heading
8434 !! input
8435 ==Section with a [[Main Page|link]] in it==
8436 !! result
8437 <h2><span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</span></h2>
8438
8439 !! end
8440
8441 !! test
8442 TOC regression (bug 12077)
8443 !! input
8444 __TOC__
8445 == title 1 ==
8446 === title 1.1 ===
8447 == title 2 ==
8448 !! result
8449 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8450 <ul>
8451 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8452 <ul>
8453 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
8454 </ul>
8455 </li>
8456 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8457 </ul>
8458 </td></tr></table>
8459 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8460 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8461 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span></h2>
8462
8463 !! end
8464
8465 !! test
8466 BUG 1219 URL next to image (good)
8467 !! input
8468 http://example.com [[Image:foobar.jpg]]
8469 !! result
8470 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8471 </p>
8472 !!end
8473
8474 !! test
8475 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8476 !! input
8477 ===
8478 The line above must have a trailing space!
8479 === <!--
8480 --> <!-- -->
8481 But just in case it doesn't...
8482 !! result
8483 <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span></h1>
8484 <p>The line above must have a trailing space!
8485 </p>
8486 <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span></h1>
8487 <p>But just in case it doesn't...
8488 </p>
8489 !! end
8490
8491 !! test
8492 Header with special characters (bug 25462)
8493 !! input
8494 The tooltips shall not show entities to the user (ie. be double escaped)
8495
8496 == text > text ==
8497 section 1
8498
8499 == text < text ==
8500 section 2
8501
8502 == text & text ==
8503 section 3
8504
8505 == text ' text ==
8506 section 4
8507
8508 == text " text ==
8509 section 5
8510 !! result
8511 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8512 </p>
8513 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8514 <ul>
8515 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
8516 <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
8517 <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
8518 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8519 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8520 </ul>
8521 </td></tr></table>
8522 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a>]</span></h2>
8523 <p>section 1
8524 </p>
8525 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a>]</span></h2>
8526 <p>section 2
8527 </p>
8528 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a>]</span></h2>
8529 <p>section 3
8530 </p>
8531 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a>]</span></h2>
8532 <p>section 4
8533 </p>
8534 <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a>]</span></h2>
8535 <p>section 5
8536 </p>
8537 !! end
8538
8539 !! test
8540 Headers with excess '=' characters
8541 (Are similar tests necessary beyond the 1st level?)
8542 !! input
8543 =foo==
8544 ==foo=
8545 =''italic'' heading==
8546 ==''italic'' heading=
8547 !! result
8548 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8549 <ul>
8550 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8551 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8552 <li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li>
8553 <li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
8554 </ul>
8555 </td></tr></table>
8556 <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a>]</span></h1>
8557 <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a>]</span></h1>
8558 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a>]</span></h1>
8559 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a>]</span></h1>
8560
8561 !! end
8562
8563 !! test
8564 HTML headers vs TOC (bug 23393)
8565 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8566 !! input
8567 <h1>Header 1</h1>
8568 == Header 1.1 ==
8569 == Header 1.2 ==
8570
8571 <h1>Header 2
8572 </h1>
8573 == Header 2.1 ==
8574 == Header 2.2 ==
8575 __NOEDITSECTION__
8576 !! result
8577 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8578 <ul>
8579 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8580 <ul>
8581 <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
8582 <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
8583 </ul>
8584 </li>
8585 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8586 <ul>
8587 <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
8588 <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
8589 </ul>
8590 </li>
8591 </ul>
8592 </td></tr></table>
8593 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
8594 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
8595 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
8596 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
8597 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
8598 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
8599
8600 !! end
8601
8602 !! test
8603 BUG 1219 URL next to image (broken)
8604 !! input
8605 http://example.com[[Image:foobar.jpg]]
8606 !! result
8607 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8608 </p>
8609 !!end
8610
8611 !! test
8612 Bug 1186 news: in the middle of text
8613 !! input
8614 http://en.wikinews.org/wiki/Wikinews:Workplace
8615 !! result
8616 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8617 </p>
8618 !!end
8619
8620
8621 !! test
8622 Namespaced link must have a title
8623 !! input
8624 [[Project:]]
8625 !! result
8626 <p>[[Project:]]
8627 </p>
8628 !!end
8629
8630 !! test
8631 Namespaced link must have a title (bad fragment version)
8632 !! input
8633 [[Project:#fragment]]
8634 !! result
8635 <p>[[Project:#fragment]]
8636 </p>
8637 !!end
8638
8639
8640 ###
8641 ### HTML tags and HTML attributes
8642 ###
8643
8644 !! test
8645 div with no attributes
8646 !! input
8647 <div>HTML rocks</div>
8648 !! result
8649 <div>HTML rocks</div>
8650
8651 !! end
8652
8653 !! test
8654 div with double-quoted attribute
8655 !! input
8656 <div id="rock">HTML rocks</div>
8657 !! result
8658 <div id="rock">HTML rocks</div>
8659
8660 !! end
8661
8662 !! test
8663 div with single-quoted attribute
8664 !! input
8665 <div id='rock'>HTML rocks</div>
8666 !! result
8667 <div id="rock">HTML rocks</div>
8668
8669 !! end
8670
8671 !! test
8672 div with unquoted attribute
8673 !! input
8674 <div id=rock>HTML rocks</div>
8675 !! result
8676 <div id="rock">HTML rocks</div>
8677
8678 !! end
8679
8680 !! test
8681 div with illegal double attributes
8682 !! input
8683 <div id="a" id="b">HTML rocks</div>
8684 !! result
8685 <div id="b">HTML rocks</div>
8686
8687 !!end
8688
8689 # FIXME: produce empty string instead of "class" in the PHP parser, following
8690 # the HTML5 spec.
8691 !! test
8692 div with empty attribute value, space before equals
8693 !! options
8694 parsoid
8695 !! input
8696 <div class =>HTML rocks</div>
8697 !! result
8698 <div class="">HTML rocks</div>
8699
8700 !! end
8701
8702 # The PHP parser escapes the opening brace to &#123; for some reason, so
8703 # disabled this test for it.
8704 !! test
8705 div with braces in attribute value
8706 !! options
8707 parsoid
8708 !! input
8709 <div title="{}">Foo</div>
8710 !! result
8711 <div title="{}">Foo</div>
8712 !! end
8713
8714 # This it very inconsistent in the PHP parser: it returns
8715 # class="class" if there is a space between the name and the equal sign (see
8716 # 'div with empty attribute value, space before equals'), but strips the
8717 # attribute completely if the space is missing. We hope that not much content
8718 # depends on this, so are implementing the behavior below in Parsoid for
8719 # consistencies' sake. Disabled for the PHP parser.
8720 # FIXME: fix this behavior in the PHP parser?
8721 !! test
8722 div with empty attribute value, no space before equals
8723 !! options
8724 parsoid
8725 !! input
8726 <div class=>HTML rocks</div>
8727 !! result
8728 <div class="">HTML rocks</div>
8729
8730 !! end
8731
8732 !! test
8733 HTML multiple attributes correction
8734 !! input
8735 <p class="error" class="awesome">Awesome!</p>
8736 !! result
8737 <p class="awesome">Awesome!</p>
8738
8739 !!end
8740
8741 !! test
8742 Table multiple attributes correction
8743 !! input
8744 {|
8745 !+ class="error" class="awesome"| status
8746 |}
8747 !! result
8748 <table>
8749 <tr>
8750 <th class="awesome"> status
8751 </th></tr></table>
8752
8753 !!end
8754
8755 !! test
8756 DIV IN UPPERCASE
8757 !! input
8758 <DIV ID="x">HTML ROCKS</DIV>
8759 !! result
8760 <div id="x">HTML ROCKS</div>
8761
8762 !!end
8763
8764 !! test
8765 Non-ASCII pseudo-tags are rendered as text
8766 !! input
8767 <khyô>
8768 !! result
8769 <p>&lt;khyô&gt;
8770 </p>
8771 !! end
8772
8773 !! test
8774 Pseudo-tag with URL 'name' renders as url link
8775 !! input
8776 <http://example.com/>
8777 !! result
8778 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8779 </p>
8780 !! end
8781
8782 !! test
8783 text with amp in the middle of nowhere
8784 !! input
8785 Remember AT&T?
8786 !!result
8787 <p>Remember AT&amp;T?
8788 </p>
8789 !! end
8790
8791 !! test
8792 text with character entity: eacute
8793 !! input
8794 I always thought &eacute; was a cute letter.
8795 !! result
8796 <p>I always thought &#233; was a cute letter.
8797 </p>
8798 !! end
8799
8800 !! test
8801 text with entity-escaped character entity-like string: eacute
8802 !! input
8803 I always thought &amp;eacute; was a cute letter.
8804 !! result
8805 <p>I always thought &amp;eacute; was a cute letter.
8806 </p>
8807 !! end
8808
8809 !! test
8810 text with undefined character entity: xacute
8811 !! input
8812 I always thought &xacute; was a cute letter.
8813 !! result
8814 <p>I always thought &amp;xacute; was a cute letter.
8815 </p>
8816 !! end
8817
8818
8819 ###
8820 ### Media links
8821 ###
8822
8823 !! test
8824 Media link
8825 !! input
8826 [[Media:Foobar.jpg]]
8827 !! result
8828 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8829 </p>
8830 !! end
8831
8832 !! test
8833 Media link with text
8834 !! input
8835 [[Media:Foobar.jpg|A neat file to look at]]
8836 !! result
8837 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8838 </p>
8839 !! end
8840
8841 # FIXME: this is still bad HTML tag nesting
8842 !! test
8843 Media link with nasty text
8844 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8845 !! input
8846 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8847 !! result
8848 <a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a>
8849
8850 !! end
8851
8852 !! test
8853 Media link to nonexistent file (bug 1702)
8854 !! input
8855 [[Media:No such.jpg]]
8856 !! result
8857 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8858 </p>
8859 !! end
8860
8861 !! test
8862 Image link to nonexistent file (bug 1850 - good)
8863 !! input
8864 [[Image:No such.jpg]]
8865 !! result
8866 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
8867 </p>
8868 !! end
8869
8870 !! test
8871 :Image link to nonexistent file (bug 1850 - bad)
8872 !! input
8873 [[:Image:No such.jpg]]
8874 !! result
8875 <p><a href="/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
8876 </p>
8877 !! end
8878
8879
8880
8881 !! test
8882 Character reference normalization in link text (bug 1938)
8883 !! input
8884 [[Main Page|this&that]]
8885 !! result
8886 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8887 </p>
8888 !!end
8889
8890 !! article
8891 אַ
8892 !! text
8893 Test for unicode normalization
8894
8895 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8896 !! endarticle
8897
8898 !! test
8899 (bug 19451) Links should refer to the normalized form.
8900 !! input
8901 [[&#xFB2E;]]
8902 [[&#x5d0;&#x5b7;]]
8903 [[&#x5d0;ַ]]
8904 [[א&#x5b7;]]
8905 [[אַ]]
8906 !! result
8907 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8908 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8909 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8910 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8911 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8912 </p>
8913 !! end
8914
8915 !! test
8916 Empty attribute crash test (bug 2067)
8917 !! input
8918 <font color="">foo</font>
8919 !! result
8920 <p><font color="">foo</font>
8921 </p>
8922 !! end
8923
8924 !! test
8925 Empty attribute crash test single-quotes (bug 2067)
8926 !! input
8927 <font color=''>foo</font>
8928 !! result
8929 <p><font color="">foo</font>
8930 </p>
8931 !! end
8932
8933 !! test
8934 Attribute test: equals, then nothing
8935 !! input
8936 <font color=>foo</font>
8937 !! result
8938 <p><font>foo</font>
8939 </p>
8940 !! end
8941
8942 !! test
8943 Attribute test: unquoted value
8944 !! input
8945 <font color=x>foo</font>
8946 !! result
8947 <p><font color="x">foo</font>
8948 </p>
8949 !! end
8950
8951 !! test
8952 Attribute test: unquoted but illegal value (hash)
8953 !! input
8954 <font color=#x>foo</font>
8955 !! result
8956 <p><font color="#x">foo</font>
8957 </p>
8958 !! end
8959
8960 !! test
8961 Attribute test: no value
8962 !! input
8963 <font color>foo</font>
8964 !! result
8965 <p><font color="color">foo</font>
8966 </p>
8967 !! end
8968
8969 !! test
8970 Bug 2095: link with three closing brackets
8971 !! input
8972 [[Main Page]]]
8973 !! result
8974 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8975 </p>
8976 !! end
8977
8978 !! test
8979 Bug 2095: link with pipe and three closing brackets
8980 !! input
8981 [[Main Page|link]]]
8982 !! result
8983 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8984 </p>
8985 !! end
8986
8987 !! test
8988 Bug 2095: link with pipe and three closing brackets, version 2
8989 !! input
8990 [[Main Page|[http://example.com/]]]
8991 !! result
8992 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8993 </p>
8994 !! end
8995
8996
8997 ###
8998 ### Safety
8999 ###
9000
9001 !! article
9002 Template:Dangerous attribute
9003 !! text
9004 " onmouseover="alert(document.cookie)
9005 !! endarticle
9006
9007 !! article
9008 Template:Dangerous style attribute
9009 !! text
9010 border-size: expression(alert(document.cookie))
9011 !! endarticle
9012
9013 !! article
9014 Template:Div style
9015 !! text
9016 <div style="float: right; {{{1}}}">Magic div</div>
9017 !! endarticle
9018
9019 !! test
9020 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9021 !! input
9022 <div title="{{test}}"></div>
9023 !! result
9024 <div title="This is a test template"></div>
9025
9026 !! end
9027
9028 !! test
9029 Bug 2304: HTML attribute safety (dangerous template; 2309)
9030 !! input
9031 <div title="{{dangerous attribute}}"></div>
9032 !! result
9033 <div title=""></div>
9034
9035 !! end
9036
9037 !! test
9038 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9039 !! input
9040 <div style="{{dangerous style attribute}}"></div>
9041 !! result
9042 <div style="/* insecure input */"></div>
9043
9044 !! end
9045
9046 !! test
9047 Bug 2304: HTML attribute safety (safe parameter; 2309)
9048 !! input
9049 {{div style|width: 200px}}
9050 !! result
9051 <div style="float: right; width: 200px">Magic div</div>
9052
9053 !! end
9054
9055 !! test
9056 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9057 !! input
9058 {{div style|width: expression(alert(document.cookie))}}
9059 !! result
9060 <div style="/* insecure input */">Magic div</div>
9061
9062 !! end
9063
9064 !! test
9065 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9066 !! input
9067 {{div style|"><script>alert(document.cookie)</script>}}
9068 !! result
9069 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9070
9071 !! end
9072
9073 !! test
9074 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9075 !! input
9076 {{div style|" ><script>alert(document.cookie)</script>}}
9077 !! result
9078 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9079
9080 !! end
9081
9082 !! test
9083 Bug 2304: HTML attribute safety (link)
9084 !! input
9085 <div title="[[Main Page]]"></div>
9086 !! result
9087 <div title="&#91;&#91;Main Page]]"></div>
9088
9089 !! end
9090
9091 !! test
9092 Bug 2304: HTML attribute safety (italics)
9093 !! input
9094 <div title="''foobar''"></div>
9095 !! result
9096 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9097
9098 !! end
9099
9100 !! test
9101 Bug 2304: HTML attribute safety (bold)
9102 !! input
9103 <div title="'''foobar'''"></div>
9104 !! result
9105 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9106
9107 !! end
9108
9109
9110 !! test
9111 Bug 2304: HTML attribute safety (ISBN)
9112 !! input
9113 <div title="ISBN 1234567890"></div>
9114 !! result
9115 <div title="&#73;SBN 1234567890"></div>
9116
9117 !! end
9118
9119 !! test
9120 Bug 2304: HTML attribute safety (RFC)
9121 !! input
9122 <div title="RFC 1234"></div>
9123 !! result
9124 <div title="&#82;FC 1234"></div>
9125
9126 !! end
9127
9128 !! test
9129 Bug 2304: HTML attribute safety (PMID)
9130 !! input
9131 <div title="PMID 1234567890"></div>
9132 !! result
9133 <div title="&#80;MID 1234567890"></div>
9134
9135 !! end
9136
9137 !! test
9138 Bug 2304: HTML attribute safety (web link)
9139 !! input
9140 <div title="http://example.com/"></div>
9141 !! result
9142 <div title="http&#58;//example.com/"></div>
9143
9144 !! end
9145
9146 !! test
9147 Bug 2304: HTML attribute safety (named web link)
9148 !! input
9149 <div title="[http://example.com/ link]"></div>
9150 !! result
9151 <div title="&#91;http&#58;//example.com/ link]"></div>
9152
9153 !! end
9154
9155 !! test
9156 Bug 3244: HTML attribute safety (extension; safe)
9157 !! input
9158 <div style="<nowiki>background:blue</nowiki>"></div>
9159 !! result
9160 <div style="background:blue"></div>
9161
9162 !! end
9163
9164 !! test
9165 Bug 3244: HTML attribute safety (extension; unsafe)
9166 !! input
9167 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9168 !! result
9169 <div style="/* insecure input */"></div>
9170
9171 !! end
9172
9173 # More MSIE fun discovered by Tom Gilder
9174
9175 !! test
9176 MSIE CSS safety test: spurious slash
9177 !! input
9178 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9179 !! result
9180 <div style="/* insecure input */">evil</div>
9181
9182 !! end
9183
9184 !! test
9185 MSIE CSS safety test: hex code
9186 !! input
9187 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9188 !! result
9189 <div style="/* insecure input */">evil</div>
9190
9191 !! end
9192
9193 !! test
9194 MSIE CSS safety test: comment in url
9195 !! input
9196 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9197 !! result
9198 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9199
9200 !! end
9201
9202 !! test
9203 MSIE CSS safety test: comment in expression
9204 !! input
9205 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9206 !! result
9207 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9208
9209 !! end
9210
9211
9212 !! test
9213 Table attribute legitimate extension
9214 !! input
9215 {|
9216 !+ style="<nowiki>color:blue</nowiki>"| status
9217 |}
9218 !! result
9219 <table>
9220 <tr>
9221 <th style="color:blue"> status
9222 </th></tr></table>
9223
9224 !!end
9225
9226 !! test
9227 Table attribute safety
9228 !! input
9229 {|
9230 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9231 |}
9232 !! result
9233 <table>
9234 <tr>
9235 <th style="/* insecure input */"> status
9236 </th></tr></table>
9237
9238 !! end
9239
9240 !! test
9241 CSS line continuation 1
9242 !! input
9243 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9244 !! result
9245 <div style="/* insecure input */"></div>
9246
9247 !! end
9248
9249 !! test
9250 CSS line continuation 2
9251 !! input
9252 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9253 !! result
9254 <div style="/* insecure input */"></div>
9255
9256 !! end
9257
9258 !! article
9259 Template:Identity
9260 !! text
9261 {{{1}}}
9262 !! endarticle
9263
9264 !! test
9265 Expansion of multi-line templates in attribute values (bug 6255)
9266 !! input
9267 <div style="background: {{identity|#00FF00}}">-</div>
9268 !! result
9269 <div style="background: #00FF00">-</div>
9270
9271 !! end
9272
9273
9274 !! test
9275 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9276 !! input
9277 <div style="background:
9278 #00FF00">-</div>
9279 !! result
9280 <div style="background: #00FF00">-</div>
9281
9282 !! end
9283
9284 !! test
9285 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9286 !! input
9287 <div style="background: &#10;#00FF00">-</div>
9288 !! result
9289 <div style="background: &#10;#00FF00">-</div>
9290
9291 !! end
9292
9293 ###
9294 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9295 ###
9296 !! test
9297 Parser hook: empty input
9298 !! input
9299 <tag></tag>
9300 !! result
9301 <pre>
9302 ''
9303 array (
9304 )
9305 </pre>
9306
9307 !! end
9308
9309 !! test
9310 Parser hook: empty input using terminated empty elements
9311 !! input
9312 <tag/>
9313 !! result
9314 <pre>
9315 NULL
9316 array (
9317 )
9318 </pre>
9319
9320 !! end
9321
9322 !! test
9323 Parser hook: empty input using terminated empty elements (space before)
9324 !! input
9325 <tag />
9326 !! result
9327 <pre>
9328 NULL
9329 array (
9330 )
9331 </pre>
9332
9333 !! end
9334
9335 !! test
9336 Parser hook: basic input
9337 !! input
9338 <tag>input</tag>
9339 !! result
9340 <pre>
9341 'input'
9342 array (
9343 )
9344 </pre>
9345
9346 !! end
9347
9348
9349 !! test
9350 Parser hook: case insensitive
9351 !! input
9352 <TAG>input</TAG>
9353 !! result
9354 <pre>
9355 'input'
9356 array (
9357 )
9358 </pre>
9359
9360 !! end
9361
9362
9363 !! test
9364 Parser hook: case insensitive, redux
9365 !! input
9366 <TaG>input</TAg>
9367 !! result
9368 <pre>
9369 'input'
9370 array (
9371 )
9372 </pre>
9373
9374 !! end
9375
9376 !! test
9377 Parser hook: nested tags
9378 !! options
9379 noxml
9380 !! input
9381 <tag><tag></tag></tag>
9382 !! result
9383 <pre>
9384 '<tag>'
9385 array (
9386 )
9387 </pre>&lt;/tag&gt;
9388
9389 !! end
9390
9391 !! test
9392 Parser hook: basic arguments
9393 !! input
9394 <tag width=200 height = "100" depth = '50' square></tag>
9395 !! result
9396 <pre>
9397 ''
9398 array (
9399 'width' => '200',
9400 'height' => '100',
9401 'depth' => '50',
9402 'square' => 'square',
9403 )
9404 </pre>
9405
9406 !! end
9407
9408 !! test
9409 Parser hook: argument containing a forward slash (bug 5344)
9410 !! input
9411 <tag filename='/tmp/bla'></tag>
9412 !! result
9413 <pre>
9414 ''
9415 array (
9416 'filename' => '/tmp/bla',
9417 )
9418 </pre>
9419
9420 !! end
9421
9422 !! test
9423 Parser hook: empty input using terminated empty elements (bug 2374)
9424 !! input
9425 <tag foo=bar/>text
9426 !! result
9427 <pre>
9428 NULL
9429 array (
9430 'foo' => 'bar',
9431 )
9432 </pre>text
9433
9434 !! end
9435
9436 # </tag> should be output literally since there is no matching tag that begins it
9437 !! test
9438 Parser hook: basic arguments using terminated empty elements (bug 2374)
9439 !! input
9440 <tag width=200 height = "100" depth = '50' square/>
9441 other stuff
9442 </tag>
9443 !! result
9444 <pre>
9445 NULL
9446 array (
9447 'width' => '200',
9448 'height' => '100',
9449 'depth' => '50',
9450 'square' => 'square',
9451 )
9452 </pre>
9453 <p>other stuff
9454 &lt;/tag&gt;
9455 </p>
9456 !! end
9457
9458 ###
9459 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9460 ###
9461
9462 !! test
9463 Parser hook: static parser hook not inside a comment
9464 !! input
9465 <statictag>hello, world</statictag>
9466 <statictag action=flush/>
9467 !! result
9468 <p>hello, world
9469 </p>
9470 !! end
9471
9472
9473 !! test
9474 Parser hook: static parser hook inside a comment
9475 !! input
9476 <!-- <statictag>hello, world</statictag> -->
9477 <statictag action=flush/>
9478 !! result
9479 <p><br />
9480 </p>
9481 !! end
9482
9483 # Nested template calls; this case was broken by Parser.php rev 1.506,
9484 # since reverted.
9485
9486 !! article
9487 Template:One-parameter
9488 !! text
9489 (My parameter is: {{{1}}})
9490 !! endarticle
9491
9492 !! article
9493 Template:Map-one-parameter
9494 !! text
9495 {{{{{1}}}|{{{2}}}}}
9496 !! endarticle
9497
9498 !! test
9499 Nested template calls
9500 !! input
9501 {{Map-one-parameter|One-parameter|param}}
9502 !! result
9503 <p>(My parameter is: param)
9504 </p>
9505 !! end
9506
9507
9508 ###
9509 ### Sanitizer
9510 ###
9511 !! test
9512 Sanitizer: Closing of open tags
9513 !! input
9514 <s></s><table></table>
9515 !! result
9516 <s></s><table></table>
9517
9518 !! end
9519
9520 !! test
9521 Sanitizer: Closing of open but not closed tags
9522 !! input
9523 <s>foo
9524 !! result
9525 <p><s>foo</s>
9526 </p>
9527 !! end
9528
9529 !! test
9530 Sanitizer: Closing of closed but not open tags
9531 !! input
9532 </s>
9533 !! result
9534 <p>&lt;/s&gt;
9535 </p>
9536 !! end
9537
9538 !! test
9539 Sanitizer: Closing of closed but not open table tags
9540 !! input
9541 Table not started</td></tr></table>
9542 !! result
9543 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9544 </p>
9545 !! end
9546
9547 !! test
9548 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9549 !! input
9550 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9551 !! result
9552 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9553 </p>
9554 !! end
9555
9556 !! test
9557 Sanitizer: Validating the contents of the id attribute (bug 4515)
9558 !! options
9559 disabled
9560 !! input
9561 <br id=9 />
9562 !! result
9563 Something, but definitely not <br id="9" />...
9564 !! end
9565
9566 !! test
9567 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9568 !! options
9569 disabled
9570 !! input
9571 <br id="foo" /><br id="foo" />
9572 !! result
9573 Something need to be done. foo-2 ?
9574 !! end
9575
9576 !! test
9577 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9578 !! input
9579 <div itemscope>
9580 <meta itemprop="hello" content="world">
9581 <meta http-equiv="refresh" content="5">
9582 <meta itemprop="hello" http-equiv="refresh" content="5">
9583 <link itemprop="hello" href="{{SERVER}}">
9584 <link rel="stylesheet" href="{{SERVER}}">
9585 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9586 </div>
9587 !! result
9588 <div itemscope="itemscope">
9589 <p> <meta itemprop="hello" content="world" />
9590 &lt;meta http-equiv="refresh" content="5"&gt;
9591 <meta itemprop="hello" content="5" />
9592 </p>
9593 <link itemprop="hello" href="http&#58;//example.org" />
9594 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9595 <link itemprop="hello" href="http&#58;//example.org" />
9596 </div>
9597
9598 !! end
9599
9600 !! test
9601 Language converter: output gets cut off unexpectedly (bug 5757)
9602 !! options
9603 language=zh
9604 !! input
9605 this bit is safe: }-
9606
9607 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9608
9609 then we get cut off here: }-
9610
9611 all additional text is vanished
9612 !! result
9613 <p>this bit is safe: }-
9614 </p><p>but if we add a conversion instance: xxx
9615 </p><p>then we get cut off here: }-
9616 </p><p>all additional text is vanished
9617 </p>
9618 !! end
9619
9620 !! test
9621 Self closed html pairs (bug 5487)
9622 !! options
9623 !! input
9624 <center><font id="bug" />Centered text</center>
9625 <div><font id="bug2" />In div text</div>
9626 !! result
9627 <center>&lt;font id="bug" /&gt;Centered text</center>
9628 <div>&lt;font id="bug2" /&gt;In div text</div>
9629
9630 !! end
9631
9632 #
9633 #
9634 #
9635
9636 !! test
9637 Punctuation: nbsp before exclamation
9638 !! input
9639 C'est grave !
9640 !! result
9641 <p>C'est grave&#160;!
9642 </p>
9643 !! end
9644
9645 !! test
9646 Punctuation: CSS !important (bug 11874)
9647 !! input
9648 <div style="width:50% !important">important</div>
9649 !! result
9650 <div style="width:50% !important">important</div>
9651
9652 !!end
9653
9654 !! test
9655 Punctuation: CSS ! important (bug 11874; with space after)
9656 !! input
9657 <div style="width:50% ! important">important</div>
9658 !! result
9659 <div style="width:50% ! important">important</div>
9660
9661 !!end
9662
9663
9664 !! test
9665 HTML bullet list, closed tags (bug 5497)
9666 !! input
9667 <ul>
9668 <li>One</li>
9669 <li>Two</li>
9670 </ul>
9671 !! result
9672 <ul>
9673 <li>One</li>
9674 <li>Two</li>
9675 </ul>
9676
9677 !! end
9678
9679 !! test
9680 HTML bullet list, unclosed tags (bug 5497)
9681 !! options
9682 disabled
9683 !! input
9684 <ul>
9685 <li>One
9686 <li>Two
9687 </ul>
9688 !! result
9689 <ul>
9690 <li>One
9691 </li><li>Two
9692 </li></ul>
9693
9694 !! end
9695
9696 !! test
9697 HTML ordered list, closed tags (bug 5497)
9698 !! input
9699 <ol>
9700 <li>One</li>
9701 <li>Two</li>
9702 </ol>
9703 !! result
9704 <ol>
9705 <li>One</li>
9706 <li>Two</li>
9707 </ol>
9708
9709 !! end
9710
9711 !! test
9712 HTML ordered list, unclosed tags (bug 5497)
9713 !! options
9714 disabled
9715 !! input
9716 <ol>
9717 <li>One
9718 <li>Two
9719 </ol>
9720 !! result
9721 <ol>
9722 <li>One
9723 </li><li>Two
9724 </li></ol>
9725
9726 !! end
9727
9728 !! test
9729 HTML nested bullet list, closed tags (bug 5497)
9730 !! input
9731 <ul>
9732 <li>One</li>
9733 <li>Two:
9734 <ul>
9735 <li>Sub-one</li>
9736 <li>Sub-two</li>
9737 </ul>
9738 </li>
9739 </ul>
9740 !! result
9741 <ul>
9742 <li>One</li>
9743 <li>Two:
9744 <ul>
9745 <li>Sub-one</li>
9746 <li>Sub-two</li>
9747 </ul>
9748 </li>
9749 </ul>
9750
9751 !! end
9752
9753 !! test
9754 HTML nested bullet list, open tags (bug 5497)
9755 !! options
9756 disabled
9757 !! input
9758 <ul>
9759 <li>One
9760 <li>Two:
9761 <ul>
9762 <li>Sub-one
9763 <li>Sub-two
9764 </ul>
9765 </ul>
9766 !! result
9767 <ul>
9768 <li>One
9769 </li><li>Two:
9770 <ul>
9771 <li>Sub-one
9772 </li><li>Sub-two
9773 </li></ul>
9774 </li></ul>
9775
9776 !! end
9777
9778 !! test
9779 HTML nested ordered list, closed tags (bug 5497)
9780 !! input
9781 <ol>
9782 <li>One</li>
9783 <li>Two:
9784 <ol>
9785 <li>Sub-one</li>
9786 <li>Sub-two</li>
9787 </ol>
9788 </li>
9789 </ol>
9790 !! result
9791 <ol>
9792 <li>One</li>
9793 <li>Two:
9794 <ol>
9795 <li>Sub-one</li>
9796 <li>Sub-two</li>
9797 </ol>
9798 </li>
9799 </ol>
9800
9801 !! end
9802
9803 !! test
9804 HTML nested ordered list, open tags (bug 5497)
9805 !! options
9806 disabled
9807 !! input
9808 <ol>
9809 <li>One
9810 <li>Two:
9811 <ol>
9812 <li>Sub-one
9813 <li>Sub-two
9814 </ol>
9815 </ol>
9816 !! result
9817 <ol>
9818 <li>One
9819 </li><li>Two:
9820 <ol>
9821 <li>Sub-one
9822 </li><li>Sub-two
9823 </li></ol>
9824 </li></ol>
9825
9826 !! end
9827
9828 !! test
9829 HTML ordered list item with parameters oddity
9830 !! input
9831 <ol><li id="fragment">One</li></ol>
9832 !! result
9833 <ol><li id="fragment">One</li></ol>
9834
9835 !! end
9836
9837 !!test
9838 bug 5918: autonumbering
9839 !! input
9840 [http://first/] [http://second] [ftp://ftp]
9841
9842 ftp://inlineftp
9843
9844 [mailto:enclosed@mail.tld With target]
9845
9846 [mailto:enclosed@mail.tld]
9847
9848 mailto:inline@mail.tld
9849 !! result
9850 <p><a rel="nofollow" class="external autonumber" href="http://first/">[1]</a> <a rel="nofollow" class="external autonumber" href="http://second">[2]</a> <a rel="nofollow" class="external autonumber" href="ftp://ftp">[3]</a>
9851 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9852 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9853 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9854 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9855 </p>
9856 !! end
9857
9858
9859 #
9860 # Security and HTML correctness
9861 # From Nick Jenkins' fuzz testing
9862 #
9863
9864 !! test
9865 Fuzz testing: Parser13
9866 !! input
9867 {|
9868 | http://a|
9869 !! result
9870 <table>
9871 <tr>
9872 <td>
9873 </td>
9874 </tr>
9875 </table>
9876
9877 !! end
9878
9879 !! test
9880 Fuzz testing: Parser14
9881 !! input
9882 == onmouseover= ==
9883 http://__TOC__
9884 !! result
9885 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span></h2>
9886 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9887 <ul>
9888 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9889 </ul>
9890 </td></tr></table>
9891
9892 !! end
9893
9894 !! test
9895 Fuzz testing: Parser14-table
9896 !! input
9897 ==a==
9898 {| STYLE=__TOC__
9899 !! result
9900 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span></h2>
9901 <table style="&#95;_TOC&#95;_">
9902 <tr><td></td></tr>
9903 </table>
9904
9905 !! end
9906
9907 # Known to produce bogus xml (extra </td>)
9908 !! test
9909 Fuzz testing: Parser16
9910 !! options
9911 noxml
9912 !! input
9913 {|
9914 !https://||||||
9915 !! result
9916 <table>
9917 <tr>
9918 <th>https://</th>
9919 <th></th>
9920 <th></th>
9921 <th>
9922 </td>
9923 </tr>
9924 </table>
9925
9926 !! end
9927
9928 !! test
9929 Fuzz testing: Parser21
9930 !! input
9931 {|
9932 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9933 |
9934 !! result
9935 <table>
9936 <tr>
9937 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9938 </th>
9939 <td>
9940 </td>
9941 </tr>
9942 </table>
9943
9944 !! end
9945
9946 !! test
9947 Fuzz testing: Parser22
9948 !! input
9949 http://===r:::https://b
9950
9951 {|
9952 !!result
9953 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9954 </p>
9955 <table>
9956 <tr><td></td></tr>
9957 </table>
9958
9959 !! end
9960
9961 # Known to produce bad XML for now
9962 !! test
9963 Fuzz testing: Parser24
9964 !! options
9965 noxml
9966 !! input
9967 {|
9968 {{{|
9969 <u CLASS=
9970 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9971 <br style="onmouseover='alert(document.cookie);' " />
9972
9973 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9974 |
9975 !! result
9976 <table>
9977 {{{|
9978 <u class="&#124;">}}}} &gt;
9979 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9980
9981 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9982 <tr>
9983 <td></u>
9984 </td>
9985 </tr>
9986 </table>
9987
9988 !! end
9989
9990 # Note: the current result listed for this is not what the original one was,
9991 # but the original bug was JavaScript injection, which is fixed in any case.
9992 # It's not clear that the original result listed was any more correct than the
9993 # current one. Original result:
9994 # <p>{{{|
9995 # </p>
9996 # <li class="&#124;&#124;">
9997 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9998 !!test
9999 Fuzz testing: Parser25 (bug 6055)
10000 !! input
10001 {{{
10002 |
10003 <LI CLASS=||
10004 >
10005 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
10006 !! result
10007 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
10008 </p>
10009 !! end
10010
10011 !!test
10012 Fuzz testing: URL adjacent extension (with space, clean)
10013 !! options
10014 !! input
10015 http://example.com <nowiki>junk</nowiki>
10016 !! result
10017 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
10018 </p>
10019 !!end
10020
10021 !!test
10022 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10023 !! options
10024 !! input
10025 http://example.com<nowiki>junk</nowiki>
10026 !! result
10027 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10028 </p>
10029 !!end
10030
10031 !!test
10032 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10033 !! options
10034 !! input
10035 http://example.com<pre>junk</pre>
10036 !! result
10037 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10038
10039 !!end
10040
10041 !!test
10042 Fuzz testing: image with bogus manual thumbnail
10043 !!input
10044 [[Image:foobar.jpg|thumbnail= ]]
10045 !!result
10046 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
10047
10048 !!end
10049
10050 !! test
10051 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10052 !! input
10053 <pre dir="&#10;"></pre>
10054 !! result
10055 <pre dir="&#10;"></pre>
10056
10057 !! end
10058
10059 !! test
10060 Parsing optional HTML elements (Bug 6171)
10061 !! options
10062 !! input
10063 <table>
10064 <tr>
10065 <td> Some tabular data</td>
10066 <td> More tabular data ...
10067 <td> And yet som tabular data</td>
10068 </tr>
10069 </table>
10070 !! result
10071 <table>
10072 <tr>
10073 <td> Some tabular data</td>
10074 <td> More tabular data ...
10075 </td><td> And yet som tabular data</td>
10076 </tr>
10077 </table>
10078
10079 !! end
10080
10081 !! test
10082 Correct handling of <td>, <tr> (Bug 6171)
10083 !! options
10084 !! input
10085 <table>
10086 <tr>
10087 <td> Some tabular data</td>
10088 <td> More tabular data ...</td>
10089 <td> And yet som tabular data</td>
10090 </tr>
10091 </table>
10092 !! result
10093 <table>
10094 <tr>
10095 <td> Some tabular data</td>
10096 <td> More tabular data ...</td>
10097 <td> And yet som tabular data</td>
10098 </tr>
10099 </table>
10100
10101 !! end
10102
10103
10104 !! test
10105 Parsing crashing regression (fr:JavaScript)
10106 !! input
10107 </body></x>
10108 !! result
10109 <p>&lt;/body&gt;&lt;/x&gt;
10110 </p>
10111 !! end
10112
10113 !! test
10114 Inline wiki vs wiki block nesting
10115 !! input
10116 '''Bold paragraph
10117
10118 New wiki paragraph
10119 !! result
10120 <p><b>Bold paragraph</b>
10121 </p><p>New wiki paragraph
10122 </p>
10123 !! end
10124
10125 !! test
10126 Inline HTML vs wiki block nesting
10127 !! options
10128 disabled
10129 !! input
10130 <b>Bold paragraph
10131
10132 New wiki paragraph
10133 !! result
10134 <p><b>Bold paragraph</b>
10135 </p><p>New wiki paragraph
10136 </p>
10137 !! end
10138
10139 # Original result was this:
10140 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10141 # </p>
10142 # While that might be marginally more intuitive, maybe, the six-apostrophe
10143 # construct is clearly pathological and the result stated here (which is what
10144 # the parser actually does) is about as reasonable as anything.
10145 !!test
10146 Mixing markup for italics and bold
10147 !! options
10148 !! input
10149 '''bold''''''bold''bolditalics'''''
10150 !! result
10151 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10152 </p>
10153 !! end
10154
10155
10156 !! article
10157 Xyzzyx
10158 !! text
10159 Article for special page transclusion test
10160 !! endarticle
10161
10162 !! test
10163 Special page transclusion
10164 !! options
10165 !! input
10166 {{Special:Prefixindex/Xyzzyx}}
10167 !! result
10168 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10169
10170 !! end
10171
10172 !! test
10173 Special page transclusion twice (bug 5021)
10174 !! options
10175 !! input
10176 {{Special:Prefixindex/Xyzzyx}}
10177 {{Special:Prefixindex/Xyzzyx}}
10178 !! result
10179 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10180 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10181
10182 !! end
10183
10184 !! test
10185 Transclusion of default MediaWiki message
10186 !! input
10187 {{MediaWiki:Mainpage}}
10188 !!result
10189 <p>Main Page
10190 </p>
10191 !! end
10192
10193 !! test
10194 Transclusion of nonexistent MediaWiki message
10195 !! input
10196 {{MediaWiki:Mainpagexxx}}
10197 !!result
10198 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit&amp;redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a>
10199 </p>
10200 !! end
10201
10202 !! test
10203 Transclusion of MediaWiki message with underscore
10204 !! input
10205 {{MediaWiki:history_short}}
10206 !! result
10207 <p>History
10208 </p>
10209 !! end
10210
10211 !! test
10212 Transclusion of MediaWiki message with space
10213 !! input
10214 {{MediaWiki:history short}}
10215 !! result
10216 <p>History
10217 </p>
10218 !! end
10219
10220 !! test
10221 Invalid header with following text
10222 !! input
10223 = x = y
10224 !! result
10225 <p>= x = y
10226 </p>
10227 !! end
10228
10229
10230 !! test
10231 Section extraction test (section 0)
10232 !! options
10233 section=0
10234 !! input
10235 start
10236 ==a==
10237 ===aa===
10238 ====aaa====
10239 ==b==
10240 ===ba===
10241 ===bb===
10242 ====bba====
10243 ===bc===
10244 ==c==
10245 ===ca===
10246 !! result
10247 start
10248 !! end
10249
10250 !! test
10251 Section extraction test (section 1)
10252 !! options
10253 section=1
10254 !! input
10255 start
10256 ==a==
10257 ===aa===
10258 ====aaa====
10259 ==b==
10260 ===ba===
10261 ===bb===
10262 ====bba====
10263 ===bc===
10264 ==c==
10265 ===ca===
10266 !! result
10267 ==a==
10268 ===aa===
10269 ====aaa====
10270 !! end
10271
10272 !! test
10273 Section extraction test (section 2)
10274 !! options
10275 section=2
10276 !! input
10277 start
10278 ==a==
10279 ===aa===
10280 ====aaa====
10281 ==b==
10282 ===ba===
10283 ===bb===
10284 ====bba====
10285 ===bc===
10286 ==c==
10287 ===ca===
10288 !! result
10289 ===aa===
10290 ====aaa====
10291 !! end
10292
10293 !! test
10294 Section extraction test (section 3)
10295 !! options
10296 section=3
10297 !! input
10298 start
10299 ==a==
10300 ===aa===
10301 ====aaa====
10302 ==b==
10303 ===ba===
10304 ===bb===
10305 ====bba====
10306 ===bc===
10307 ==c==
10308 ===ca===
10309 !! result
10310 ====aaa====
10311 !! end
10312
10313 !! test
10314 Section extraction test (section 4)
10315 !! options
10316 section=4
10317 !! input
10318 start
10319 ==a==
10320 ===aa===
10321 ====aaa====
10322 ==b==
10323 ===ba===
10324 ===bb===
10325 ====bba====
10326 ===bc===
10327 ==c==
10328 ===ca===
10329 !! result
10330 ==b==
10331 ===ba===
10332 ===bb===
10333 ====bba====
10334 ===bc===
10335 !! end
10336
10337 !! test
10338 Section extraction test (section 5)
10339 !! options
10340 section=5
10341 !! input
10342 start
10343 ==a==
10344 ===aa===
10345 ====aaa====
10346 ==b==
10347 ===ba===
10348 ===bb===
10349 ====bba====
10350 ===bc===
10351 ==c==
10352 ===ca===
10353 !! result
10354 ===ba===
10355 !! end
10356
10357 !! test
10358 Section extraction test (section 6)
10359 !! options
10360 section=6
10361 !! input
10362 start
10363 ==a==
10364 ===aa===
10365 ====aaa====
10366 ==b==
10367 ===ba===
10368 ===bb===
10369 ====bba====
10370 ===bc===
10371 ==c==
10372 ===ca===
10373 !! result
10374 ===bb===
10375 ====bba====
10376 !! end
10377
10378 !! test
10379 Section extraction test (section 7)
10380 !! options
10381 section=7
10382 !! input
10383 start
10384 ==a==
10385 ===aa===
10386 ====aaa====
10387 ==b==
10388 ===ba===
10389 ===bb===
10390 ====bba====
10391 ===bc===
10392 ==c==
10393 ===ca===
10394 !! result
10395 ====bba====
10396 !! end
10397
10398 !! test
10399 Section extraction test (section 8)
10400 !! options
10401 section=8
10402 !! input
10403 start
10404 ==a==
10405 ===aa===
10406 ====aaa====
10407 ==b==
10408 ===ba===
10409 ===bb===
10410 ====bba====
10411 ===bc===
10412 ==c==
10413 ===ca===
10414 !! result
10415 ===bc===
10416 !! end
10417
10418 !! test
10419 Section extraction test (section 9)
10420 !! options
10421 section=9
10422 !! input
10423 start
10424 ==a==
10425 ===aa===
10426 ====aaa====
10427 ==b==
10428 ===ba===
10429 ===bb===
10430 ====bba====
10431 ===bc===
10432 ==c==
10433 ===ca===
10434 !! result
10435 ==c==
10436 ===ca===
10437 !! end
10438
10439 !! test
10440 Section extraction test (section 10)
10441 !! options
10442 section=10
10443 !! input
10444 start
10445 ==a==
10446 ===aa===
10447 ====aaa====
10448 ==b==
10449 ===ba===
10450 ===bb===
10451 ====bba====
10452 ===bc===
10453 ==c==
10454 ===ca===
10455 !! result
10456 ===ca===
10457 !! end
10458
10459 !! test
10460 Section extraction test (nonexistent section 11)
10461 !! options
10462 section=11
10463 !! input
10464 start
10465 ==a==
10466 ===aa===
10467 ====aaa====
10468 ==b==
10469 ===ba===
10470 ===bb===
10471 ====bba====
10472 ===bc===
10473 ==c==
10474 ===ca===
10475 !! result
10476 !! end
10477
10478 !! test
10479 Section extraction test with bogus heading (section 1)
10480 !! options
10481 section=1
10482 !! input
10483 ==a==
10484 ==bogus== not a legal section
10485 ==b==
10486 !! result
10487 ==a==
10488 ==bogus== not a legal section
10489 !! end
10490
10491 !! test
10492 Section extraction test with bogus heading (section 2)
10493 !! options
10494 section=2
10495 !! input
10496 ==a==
10497 ==bogus== not a legal section
10498 ==b==
10499 !! result
10500 ==b==
10501 !! end
10502
10503 !! test
10504 Section extraction test with comment after heading (section 1)
10505 !! options
10506 section=1
10507 !! input
10508 ==a==
10509 ==b== <!-- -->
10510 ==c==
10511 !! result
10512 ==a==
10513 !! end
10514
10515 !! test
10516 Section extraction test with comment after heading (section 2)
10517 !! options
10518 section=2
10519 !! input
10520 ==a==
10521 ==b== <!-- -->
10522 ==c==
10523 !! result
10524 ==b== <!-- -->
10525 !! end
10526
10527 !! test
10528 Section extraction test with bogus <nowiki> heading (section 1)
10529 !! options
10530 section=1
10531 !! input
10532 ==a==
10533 ==bogus== <nowiki>not a legal section</nowiki>
10534 ==b==
10535 !! result
10536 ==a==
10537 ==bogus== <nowiki>not a legal section</nowiki>
10538 !! end
10539
10540 !! test
10541 Section extraction test with bogus <nowiki> heading (section 2)
10542 !! options
10543 section=2
10544 !! input
10545 ==a==
10546 ==bogus== <nowiki>not a legal section</nowiki>
10547 ==b==
10548 !! result
10549 ==b==
10550 !! end
10551
10552
10553 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10554 # instead of respecting commented sections
10555 !! test
10556 Section extraction prefixed by comment (section 1)
10557 !! options
10558 section=1
10559 !! input
10560 <!-- -->==sec1==
10561 ==sec2==
10562 !!result
10563 ==sec2==
10564 !!end
10565
10566 !! test
10567 Section extraction prefixed by comment (section 2)
10568 !! options
10569 section=2
10570 !! input
10571 <!-- -->==sec1==
10572 ==sec2==
10573 !!result
10574
10575 !!end
10576
10577
10578 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10579 # instead of respecting HTML-style headings
10580 !! test
10581 Section extraction, mixed wiki and html (section 1)
10582 !! options
10583 section=1
10584 !! input
10585 <h2>unmarked</h2>
10586 unmarked
10587 ==1==
10588 one
10589 ==2==
10590 two
10591 !! result
10592 ==1==
10593 one
10594 !! end
10595
10596 !! test
10597 Section extraction, mixed wiki and html (section 2)
10598 !! options
10599 section=2
10600 !! input
10601 <h2>unmarked</h2>
10602 unmarked
10603 ==1==
10604 one
10605 ==2==
10606 two
10607 !! result
10608 ==2==
10609 two
10610 !! end
10611
10612
10613 # Formerly testing for bug 3342
10614 !! test
10615 Section extraction, heading surrounded by <noinclude>
10616 !! options
10617 section=1
10618 !! input
10619 <noinclude>==unmarked==</noinclude>
10620 ==marked==
10621 !! result
10622 ==marked==
10623 !!end
10624
10625 # Test behavior of bug 19910
10626 !! test
10627 Sectiion with all-equals
10628 !! options
10629 section=2
10630 !! input
10631 ===
10632 The line above must have a trailing space
10633 === <!--
10634 --> <!-- -->
10635 But just in case it doesn't...
10636 !! result
10637 === <!--
10638 --> <!-- -->
10639 But just in case it doesn't...
10640 !! end
10641
10642 !! test
10643 Section replacement test (section 0)
10644 !! options
10645 replace=0,"xxx"
10646 !! input
10647 start
10648 ==a==
10649 ===aa===
10650 ====aaa====
10651 ==b==
10652 ===ba===
10653 ===bb===
10654 ====bba====
10655 ===bc===
10656 ==c==
10657 ===ca===
10658 !! result
10659 xxx
10660
10661 ==a==
10662 ===aa===
10663 ====aaa====
10664 ==b==
10665 ===ba===
10666 ===bb===
10667 ====bba====
10668 ===bc===
10669 ==c==
10670 ===ca===
10671 !! end
10672
10673 !! test
10674 Section replacement test (section 1)
10675 !! options
10676 replace=1,"xxx"
10677 !! input
10678 start
10679 ==a==
10680 ===aa===
10681 ====aaa====
10682 ==b==
10683 ===ba===
10684 ===bb===
10685 ====bba====
10686 ===bc===
10687 ==c==
10688 ===ca===
10689 !! result
10690 start
10691 xxx
10692
10693 ==b==
10694 ===ba===
10695 ===bb===
10696 ====bba====
10697 ===bc===
10698 ==c==
10699 ===ca===
10700 !! end
10701
10702 !! test
10703 Section replacement test (section 2)
10704 !! options
10705 replace=2,"xxx"
10706 !! input
10707 start
10708 ==a==
10709 ===aa===
10710 ====aaa====
10711 ==b==
10712 ===ba===
10713 ===bb===
10714 ====bba====
10715 ===bc===
10716 ==c==
10717 ===ca===
10718 !! result
10719 start
10720 ==a==
10721 xxx
10722
10723 ==b==
10724 ===ba===
10725 ===bb===
10726 ====bba====
10727 ===bc===
10728 ==c==
10729 ===ca===
10730 !! end
10731
10732 !! test
10733 Section replacement test (section 3)
10734 !! options
10735 replace=3,"xxx"
10736 !! input
10737 start
10738 ==a==
10739 ===aa===
10740 ====aaa====
10741 ==b==
10742 ===ba===
10743 ===bb===
10744 ====bba====
10745 ===bc===
10746 ==c==
10747 ===ca===
10748 !! result
10749 start
10750 ==a==
10751 ===aa===
10752 xxx
10753
10754 ==b==
10755 ===ba===
10756 ===bb===
10757 ====bba====
10758 ===bc===
10759 ==c==
10760 ===ca===
10761 !! end
10762
10763 !! test
10764 Section replacement test (section 4)
10765 !! options
10766 replace=4,"xxx"
10767 !! input
10768 start
10769 ==a==
10770 ===aa===
10771 ====aaa====
10772 ==b==
10773 ===ba===
10774 ===bb===
10775 ====bba====
10776 ===bc===
10777 ==c==
10778 ===ca===
10779 !! result
10780 start
10781 ==a==
10782 ===aa===
10783 ====aaa====
10784 xxx
10785
10786 ==c==
10787 ===ca===
10788 !! end
10789
10790 !! test
10791 Section replacement test (section 5)
10792 !! options
10793 replace=5,"xxx"
10794 !! input
10795 start
10796 ==a==
10797 ===aa===
10798 ====aaa====
10799 ==b==
10800 ===ba===
10801 ===bb===
10802 ====bba====
10803 ===bc===
10804 ==c==
10805 ===ca===
10806 !! result
10807 start
10808 ==a==
10809 ===aa===
10810 ====aaa====
10811 ==b==
10812 xxx
10813
10814 ===bb===
10815 ====bba====
10816 ===bc===
10817 ==c==
10818 ===ca===
10819 !! end
10820
10821 !! test
10822 Section replacement test (section 6)
10823 !! options
10824 replace=6,"xxx"
10825 !! input
10826 start
10827 ==a==
10828 ===aa===
10829 ====aaa====
10830 ==b==
10831 ===ba===
10832 ===bb===
10833 ====bba====
10834 ===bc===
10835 ==c==
10836 ===ca===
10837 !! result
10838 start
10839 ==a==
10840 ===aa===
10841 ====aaa====
10842 ==b==
10843 ===ba===
10844 xxx
10845
10846 ===bc===
10847 ==c==
10848 ===ca===
10849 !! end
10850
10851 !! test
10852 Section replacement test (section 7)
10853 !! options
10854 replace=7,"xxx"
10855 !! input
10856 start
10857 ==a==
10858 ===aa===
10859 ====aaa====
10860 ==b==
10861 ===ba===
10862 ===bb===
10863 ====bba====
10864 ===bc===
10865 ==c==
10866 ===ca===
10867 !! result
10868 start
10869 ==a==
10870 ===aa===
10871 ====aaa====
10872 ==b==
10873 ===ba===
10874 ===bb===
10875 xxx
10876
10877 ===bc===
10878 ==c==
10879 ===ca===
10880 !! end
10881
10882 !! test
10883 Section replacement test (section 8)
10884 !! options
10885 replace=8,"xxx"
10886 !! input
10887 start
10888 ==a==
10889 ===aa===
10890 ====aaa====
10891 ==b==
10892 ===ba===
10893 ===bb===
10894 ====bba====
10895 ===bc===
10896 ==c==
10897 ===ca===
10898 !! result
10899 start
10900 ==a==
10901 ===aa===
10902 ====aaa====
10903 ==b==
10904 ===ba===
10905 ===bb===
10906 ====bba====
10907 xxx
10908
10909 ==c==
10910 ===ca===
10911 !!end
10912
10913 !! test
10914 Section replacement test (section 9)
10915 !! options
10916 replace=9,"xxx"
10917 !! input
10918 start
10919 ==a==
10920 ===aa===
10921 ====aaa====
10922 ==b==
10923 ===ba===
10924 ===bb===
10925 ====bba====
10926 ===bc===
10927 ==c==
10928 ===ca===
10929 !! result
10930 start
10931 ==a==
10932 ===aa===
10933 ====aaa====
10934 ==b==
10935 ===ba===
10936 ===bb===
10937 ====bba====
10938 ===bc===
10939 xxx
10940 !! end
10941
10942 !! test
10943 Section replacement test (section 10)
10944 !! options
10945 replace=10,"xxx"
10946 !! input
10947 start
10948 ==a==
10949 ===aa===
10950 ====aaa====
10951 ==b==
10952 ===ba===
10953 ===bb===
10954 ====bba====
10955 ===bc===
10956 ==c==
10957 ===ca===
10958 !! result
10959 start
10960 ==a==
10961 ===aa===
10962 ====aaa====
10963 ==b==
10964 ===ba===
10965 ===bb===
10966 ====bba====
10967 ===bc===
10968 ==c==
10969 xxx
10970 !! end
10971
10972 !! test
10973 Section replacement test with initial whitespace (bug 13728)
10974 !! options
10975 replace=2,"xxx"
10976 !! input
10977 Preformatted initial line
10978 ==a==
10979 ===a===
10980 !! result
10981 Preformatted initial line
10982 ==a==
10983 xxx
10984 !! end
10985
10986
10987 !! test
10988 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10989 !! options
10990 section=1
10991 !! input
10992 ==a==
10993 a
10994 !! result
10995 ==a==
10996 a
10997 !! end
10998
10999 !! test
11000 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
11001 !! options
11002 section=1
11003 !! input
11004 ==a==
11005 a
11006 !! result
11007 ==a==
11008 a
11009 !! end
11010
11011
11012 !! test
11013 Section extraction, <pre> around bogus header (bug 10309)
11014 !! options
11015 noxml section=2
11016 !! input
11017 == Section One ==
11018 <pre>
11019 =======
11020 </pre>
11021
11022 == Section Two ==
11023 stuff
11024 !! result
11025 == Section Two ==
11026 stuff
11027 !! end
11028
11029 !! test
11030 Section replacement, <pre> around bogus header (bug 10309)
11031 !! options
11032 noxml replace=2,"xxx"
11033 !! input
11034 == Section One ==
11035 <pre>
11036 =======
11037 </pre>
11038
11039 == Section Two ==
11040 stuff
11041 !! result
11042 == Section One ==
11043 <pre>
11044 =======
11045 </pre>
11046
11047 xxx
11048 !! end
11049
11050
11051
11052 !! test
11053 Handling of &#x0A; in URLs
11054 !! input
11055 **irc://&#x0A;a
11056 !! result
11057 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11058 </li></ul>
11059 </li></ul>
11060
11061 !!end
11062
11063 !! test
11064 5 quotes, code coverage +1 line (php)
11065 !! options
11066 php
11067 !! input
11068 '''''
11069 !! result
11070 !! end
11071 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11072 !! test
11073 5 quotes, code coverage +1 line (parsoid)
11074 !! options
11075 parsoid
11076 !! input
11077 '''''
11078 !! result
11079 <p><i><b></b></i></p>
11080 !! end
11081
11082 !! test
11083 Special:Search page linking.
11084 !! input
11085 {{Special:search}}
11086 !! result
11087 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11088 </p>
11089 !! end
11090
11091 !! test
11092 Say the magic word
11093 !! input
11094 * {{PAGENAME}}
11095 * {{BASEPAGENAME}}
11096 * {{SUBPAGENAME}}
11097 * {{SUBPAGENAMEE}}
11098 * {{ROOTPAGENAME}}
11099 * {{ROOTPAGENAMEE}}
11100 * {{BASEPAGENAME}}
11101 * {{BASEPAGENAMEE}}
11102 * {{TALKPAGENAME}}
11103 * {{TALKPAGENAMEE}}
11104 * {{SUBJECTPAGENAME}}
11105 * {{SUBJECTPAGENAMEE}}
11106 * {{NAMESPACEE}}
11107 * {{NAMESPACE}}
11108 * {{TALKSPACE}}
11109 * {{TALKSPACEE}}
11110 * {{SUBJECTSPACE}}
11111 * {{SUBJECTSPACEE}}
11112 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11113 !! result
11114 <ul><li> Parser test
11115 </li><li> Parser test
11116 </li><li> Parser test
11117 </li><li> Parser_test
11118 </li><li> Parser test
11119 </li><li> Parser_test
11120 </li><li> Parser test
11121 </li><li> Parser_test
11122 </li><li> Talk:Parser test
11123 </li><li> Talk:Parser_test
11124 </li><li> Parser test
11125 </li><li> Parser_test
11126 </li><li>
11127 </li><li>
11128 </li><li> Talk
11129 </li><li> Talk
11130 </li><li>
11131 </li><li>
11132 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a>
11133 </li></ul>
11134
11135 !! end
11136 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11137
11138 !! test
11139 Gallery
11140 !! input
11141 <gallery>
11142 image1.png |
11143 image2.gif|||||
11144
11145 image3|
11146 image4 |300px| centre
11147 image5.svg| http://///////
11148 [[x|xx]]]]
11149 * image6
11150 </gallery>
11151 !! result
11152 <ul class="gallery">
11153 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11154 <div style="height: 150px;">Image1.png</div>
11155 <div class="gallerytext">
11156 </div>
11157 </div></li>
11158 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11159 <div style="height: 150px;">Image2.gif</div>
11160 <div class="gallerytext">
11161 <p>||||
11162 </p>
11163 </div>
11164 </div></li>
11165 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11166 <div style="height: 150px;">Image3</div>
11167 <div class="gallerytext">
11168 </div>
11169 </div></li>
11170 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11171 <div style="height: 150px;">Image4</div>
11172 <div class="gallerytext">
11173 <p>300px| centre
11174 </p>
11175 </div>
11176 </div></li>
11177 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11178 <div style="height: 150px;">Image5.svg</div>
11179 <div class="gallerytext">
11180 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11181 </p>
11182 </div>
11183 </div></li>
11184 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11185 <div style="height: 150px;">* image6</div>
11186 <div class="gallerytext">
11187 </div>
11188 </div></li>
11189 </ul>
11190
11191 !! end
11192
11193 !! test
11194 Gallery (with options)
11195 !! input
11196 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11197 File:Nonexistant.jpg|caption
11198 File:Nonexistant.jpg
11199 image:foobar.jpg|some '''caption''' [[Main Page]]
11200 image:foobar.jpg
11201 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11202 </gallery>
11203 !! result
11204 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11205 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11206 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11207 <div style="height: 70px;">Nonexistant.jpg</div>
11208 <div class="gallerytext">
11209 <p>caption
11210 </p>
11211 </div>
11212 </div></li>
11213 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11214 <div style="height: 70px;">Nonexistant.jpg</div>
11215 <div class="gallerytext">
11216 </div>
11217 </div></li>
11218 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11219 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11220 <div class="gallerytext">
11221 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11222 </p>
11223 </div>
11224 </div></li>
11225 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11226 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11227 <div class="gallerytext">
11228 </div>
11229 </div></li>
11230 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11231 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11232 <div class="gallerytext">
11233 <p>Blabla|blabla.
11234 </p>
11235 </div>
11236 </div></li>
11237 </ul>
11238
11239 !! end
11240
11241 !! test
11242 Gallery with wikitext inside caption
11243 !! input
11244 <gallery>
11245 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11246 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11247 </gallery>
11248 !! result
11249 <ul class="gallery">
11250 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11251 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11252 <div class="gallerytext">
11253 <p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
11254 </p>
11255 </div>
11256 </div></li>
11257 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11258 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11259 <div class="gallerytext">
11260 <p>This is a test template
11261 </p>
11262 </div>
11263 </div></li>
11264 </ul>
11265
11266 !! end
11267
11268 !! test
11269 gallery (with showfilename option)
11270 !! input
11271 <gallery showfilename>
11272 File:Nonexistant.jpg|caption
11273 File:Nonexistant.jpg
11274 image:foobar.jpg|some '''caption''' [[Main Page]]
11275 File:Foobar.jpg
11276 </gallery>
11277 !! result
11278 <ul class="gallery">
11279 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11280 <div style="height: 150px;">Nonexistant.jpg</div>
11281 <div class="gallerytext">
11282 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11283 caption
11284 </p>
11285 </div>
11286 </div></li>
11287 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11288 <div style="height: 150px;">Nonexistant.jpg</div>
11289 <div class="gallerytext">
11290 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11291 </p>
11292 </div>
11293 </div></li>
11294 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11295 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11296 <div class="gallerytext">
11297 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11298 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11299 </p>
11300 </div>
11301 </div></li>
11302 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11303 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11304 <div class="gallerytext">
11305 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11306 </p>
11307 </div>
11308 </div></li>
11309 </ul>
11310
11311 !! end
11312
11313 !! test
11314 Gallery (with namespace-less filenames)
11315 !! input
11316 <gallery>
11317 File:Nonexistant.jpg
11318 Nonexistant.jpg
11319 image:foobar.jpg
11320 foobar.jpg
11321 </gallery>
11322 !! result
11323 <ul class="gallery">
11324 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11325 <div style="height: 150px;">Nonexistant.jpg</div>
11326 <div class="gallerytext">
11327 </div>
11328 </div></li>
11329 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11330 <div style="height: 150px;">Nonexistant.jpg</div>
11331 <div class="gallerytext">
11332 </div>
11333 </div></li>
11334 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11335 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11336 <div class="gallerytext">
11337 </div>
11338 </div></li>
11339 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11340 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11341 <div class="gallerytext">
11342 </div>
11343 </div></li>
11344 </ul>
11345
11346 !! end
11347
11348 !! test
11349 HTML Hex character encoding (spells the word "JavaScript")
11350 !! input
11351 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11352 !! result
11353 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11354 </p>
11355 !! end
11356
11357 !! test
11358 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11359 !! input
11360 &#xsee;&#XSEE;
11361 !! result
11362 <p>&amp;#xsee;&amp;#XSEE;
11363 </p>
11364 !! end
11365
11366 !! test
11367 HTML Hex character encoding mixed case
11368 !! input
11369 &#xEE;&#Xee;
11370 !! result
11371 <p>&#xee;&#xee;
11372 </p>
11373 !! end
11374
11375 !! test
11376 __FORCETOC__ override
11377 !! input
11378 __NEWSECTIONLINK__
11379 __FORCETOC__
11380 !! result
11381 <p><br />
11382 </p>
11383 !! end
11384
11385 !! test
11386 ISBN code coverage
11387 !! input
11388 ISBN 978-0-1234-56&#x20;789
11389 !! result
11390 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11391 </p>
11392 !! end
11393
11394 !! test
11395 ISBN followed by 5 spaces
11396 !! input
11397 ISBN
11398 !! result
11399 <p>ISBN
11400 </p>
11401 !! end
11402
11403 !! test
11404 Double ISBN
11405 !! input
11406 ISBN ISBN 1234567890
11407 !! result
11408 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11409 </p>
11410 !! end
11411
11412 !! test
11413 Bug 22905: <abbr> followed by ISBN followed by </a>
11414 !! input
11415 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11416 !! result
11417 <p><abbr>(fr)</abbr> <a href="/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a rel="nofollow" class="external text" href="http://www.example.com">example.com</a>
11418 </p>
11419 !! end
11420
11421 !! test
11422 Double RFC
11423 !! input
11424 RFC RFC 1234
11425 !! result
11426 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11427 </p>
11428 !! end
11429
11430 !! test
11431 Double RFC with a wiki link
11432 !! input
11433 RFC [[RFC 1234]]
11434 !! result
11435 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit&amp;redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a>
11436 </p>
11437 !! end
11438
11439 !! test
11440 RFC code coverage
11441 !! input
11442 RFC 983&#x20;987
11443 !! result
11444 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11445 </p>
11446 !! end
11447
11448 !! test
11449 Centre-aligned image
11450 !! input
11451 [[Image:foobar.jpg|centre]]
11452 !! result
11453 <div class="center"><div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div></div>
11454
11455 !!end
11456
11457 !! test
11458 None-aligned image
11459 !! input
11460 [[Image:foobar.jpg|none]]
11461 !! result
11462 <div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
11463
11464 !!end
11465
11466 !! test
11467 Width + Height sized image (using px) (height is ignored)
11468 !! input
11469 [[Image:foobar.jpg|640x480px]]
11470 !! result
11471 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11472 </p>
11473 !!end
11474
11475 !! test
11476 Width-sized image (using px, no following whitespace)
11477 !! input
11478 [[Image:foobar.jpg|640px]]
11479 !! result
11480 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11481 </p>
11482 !!end
11483
11484 !! test
11485 Width-sized image (using px, with following whitespace - test regression from r39467)
11486 !! input
11487 [[Image:foobar.jpg|640px ]]
11488 !! result
11489 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11490 </p>
11491 !!end
11492
11493 !! test
11494 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11495 !! input
11496 [[Image:foobar.jpg| 640px]]
11497 !! result
11498 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11499 </p>
11500 !!end
11501
11502 !! test
11503 Another italics / bold test
11504 !! input
11505 ''' ''x'
11506 !! result
11507 <pre>'<i> </i>x'
11508 </pre>
11509 !!end
11510
11511 # Note the results may be incorrect, as parserTest output included this:
11512 # XML error: Mismatched tag at byte 6120:
11513 # ...<dd> </dt></dl> </dd...
11514 !! test
11515 dt/dd/dl test
11516 !! options
11517 disabled
11518 !! input
11519 :;;;::
11520 !! result
11521 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11522 </dd></dl>
11523 </dd></dl>
11524 </dt></dl>
11525 </dt></dl>
11526 </dt></dl>
11527 </dd></dl>
11528
11529 !!end
11530
11531
11532 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11533 !! test
11534 Images with the "|" character in the comment
11535 !! input
11536 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11537 !! result
11538 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
11539
11540 !!end
11541
11542 !! test
11543 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11544 !! input
11545 <html><script>alert(1);</script></html>
11546 !! result
11547 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11548 </p>
11549 !! end
11550
11551 !! test
11552 HTML with raw HTML ($wgRawHtml==true)
11553 !! options
11554 rawhtml
11555 !! input
11556 <html><script>alert(1);</script></html>
11557 !! result
11558 <p><script>alert(1);</script>
11559 </p>
11560 !! end
11561
11562 !! test
11563 Parents of subpages, one level up
11564 !! options
11565 subpage title=[[Subpage test/L1/L2/L3]]
11566 !! input
11567 [[../|L2]]
11568 !! result
11569 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a>
11570 </p>
11571 !! end
11572
11573
11574 !! test
11575 Parents of subpages, one level up, not named
11576 !! options
11577 subpage title=[[Subpage test/L1/L2/L3]]
11578 !! input
11579 [[../]]
11580 !! result
11581 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
11582 </p>
11583 !! end
11584
11585
11586
11587 !! test
11588 Parents of subpages, two levels up
11589 !! options
11590 subpage title=[[Subpage test/L1/L2/L3]]
11591 !! input
11592 [[../../|L1]]2
11593
11594 [[../../|L1]]l
11595 !! result
11596 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
11597 </p><p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a>
11598 </p>
11599 !! end
11600
11601 !! test
11602 Parents of subpages, two levels up, without trailing slash or name.
11603 !! options
11604 subpage title=[[Subpage test/L1/L2/L3]]
11605 !! input
11606 [[../..]]
11607 !! result
11608 <p>[[../..]]
11609 </p>
11610 !! end
11611
11612 !! test
11613 Parents of subpages, two levels up, with lots of extra trailing slashes.
11614 !! options
11615 subpage title=[[Subpage test/L1/L2/L3]]
11616 !! input
11617 [[../../////]]
11618 !! result
11619 <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1//// (page does not exist)">///</a>
11620 </p>
11621 !! end
11622
11623 !! test
11624 Definition list code coverage
11625 !! input
11626 ; title : def
11627 ; title : def
11628 ;title: def
11629 !! result
11630 <dl><dt> title &#160;</dt><dd> def
11631 </dd><dt> title&#160;</dt><dd> def
11632 </dd><dt>title</dt><dd> def
11633 </dd></dl>
11634
11635 !! end
11636
11637 !! test
11638 Don't fall for the self-closing div
11639 !! input
11640 <div>hello world</div/>
11641 !! result
11642 <div>hello world</div>
11643
11644 !! end
11645
11646 !! test
11647 MSGNW magic word
11648 !! input
11649 {{MSGNW:msg}}
11650 !! result
11651 <p>&#91;&#91;:Template:Msg&#93;&#93;
11652 </p>
11653 !! end
11654
11655 !! test
11656 RAW magic word
11657 !! input
11658 {{RAW:QUERTY}}
11659 !! result
11660 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
11661 </p>
11662 !! end
11663
11664 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11665 !! test
11666 Always escape literal '>' in output, not just after '<'
11667 !! input
11668 ><>
11669 !! result
11670 <p>&gt;&lt;&gt;
11671 </p>
11672 !! end
11673
11674 !! test
11675 Template caching
11676 !! input
11677 {{Test}}
11678 {{Test}}
11679 !! result
11680 <p>This is a test template
11681 This is a test template
11682 </p>
11683 !! end
11684
11685
11686 !! article
11687 MediaWiki:Fake
11688 !! text
11689 ==header==
11690 !! endarticle
11691
11692 !! test
11693 Inclusion of !userCanEdit() content
11694 !! input
11695 {{MediaWiki:Fake}}
11696 !! result
11697 <h2><span class="mw-headline" id="header">header</span><span class="mw-editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span></h2>
11698
11699 !! end
11700
11701
11702 !! test
11703 Out-of-order TOC heading levels
11704 !! input
11705 ==2==
11706 ======6======
11707 ===3===
11708 =1=
11709 =====5=====
11710 ==2==
11711 !! result
11712 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11713 <ul>
11714 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11715 <ul>
11716 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11717 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11718 </ul>
11719 </li>
11720 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11721 <ul>
11722 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11723 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
11724 </ul>
11725 </li>
11726 </ul>
11727 </td></tr></table>
11728 <h2><span class="mw-headline" id="2">2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span></h2>
11729 <h6><span class="mw-headline" id="6">6</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span></h6>
11730 <h3><span class="mw-headline" id="3">3</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span></h3>
11731 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span></h1>
11732 <h5><span class="mw-headline" id="5">5</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span></h5>
11733 <h2><span class="mw-headline" id="2_2">2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span></h2>
11734
11735 !! end
11736
11737
11738 !! test
11739 ISBN with a dummy number
11740 !! input
11741 ISBN ---
11742 !! result
11743 <p>ISBN ---
11744 </p>
11745 !! end
11746
11747
11748 !! test
11749 ISBN with space-delimited number
11750 !! input
11751 ISBN 92 9017 032 8
11752 !! result
11753 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11754 </p>
11755 !! end
11756
11757
11758 !! test
11759 ISBN with multiple spaces, no number
11760 !! input
11761 ISBN foo
11762 !! result
11763 <p>ISBN foo
11764 </p>
11765 !! end
11766
11767
11768 !! test
11769 ISBN length
11770 !! input
11771 ISBN 123456789
11772
11773 ISBN 1234567890
11774
11775 ISBN 12345678901
11776 !! result
11777 <p>ISBN 123456789
11778 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11779 </p><p>ISBN 12345678901
11780 </p>
11781 !! end
11782
11783
11784 !! test
11785 ISBN with trailing year (bug 8110)
11786 !! input
11787 ISBN 1-234-56789-0 - 2006
11788
11789 ISBN 1 234 56789 0 - 2006
11790 !! result
11791 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11792 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11793 </p>
11794 !! end
11795
11796
11797 !! test
11798 anchorencode
11799 !! input
11800 {{anchorencode:foo bar©#%n}}
11801 !! result
11802 <p>foo_bar.C2.A9.23.25n
11803 </p>
11804 !! end
11805
11806 !! test
11807 anchorencode trims spaces
11808 !! input
11809 {{anchorencode: __pretty__please__}}
11810 !! result
11811 <p>pretty_please
11812 </p>
11813 !! end
11814
11815 !! test
11816 anchorencode deals with links
11817 !! input
11818 {{anchorencode: [[hello|world]] [[hi]]}}
11819 !! result
11820 <p>world_hi
11821 </p>
11822 !! end
11823
11824 !! test
11825 anchorencode deals with templates
11826 !! input
11827 {{anchorencode: {{Foo}} }}
11828 !! result
11829 <p>FOO
11830 </p>
11831 !! end
11832
11833 !! test
11834 anchorencode encodes like the TOC generator: (bug 18431)
11835 !! input
11836 === _ +:.3A%3A&&amp;]] ===
11837 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11838 __NOEDITSECTION__
11839 !! result
11840 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
11841 <p>.2B:.3A.253A.26.26.5D.5D
11842 </p>
11843 !! end
11844
11845 # Expected output in the following test is not necessarily expected (there
11846 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11847 # only testing for well-formedness.
11848 !! test
11849 Bug 6200: blockquotes and paragraph formatting
11850 !! input
11851 <blockquote>
11852 foo
11853 </blockquote>
11854
11855 bar
11856
11857 baz
11858 !! result
11859 <blockquote>
11860 foo
11861 </blockquote>
11862 <p>bar
11863 </p>
11864 <pre>baz
11865 </pre>
11866 !! end
11867
11868 !! test
11869 Bug 8293: Use of center tag ruins paragraph formatting
11870 !! input
11871 <center>
11872 foo
11873 </center>
11874
11875 bar
11876
11877 baz
11878 !! result
11879 <center>
11880 <p>foo
11881 </p>
11882 </center>
11883 <p>bar
11884 </p>
11885 <pre>baz
11886 </pre>
11887 !! end
11888
11889 !!test
11890 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
11891 !!options
11892 php
11893 !!input
11894 <span><s>x</span></s>
11895 !!result
11896 <p><span><s>x&lt;/span&gt;</s></span>
11897 </p>
11898 !!end
11899
11900 !!test
11901 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
11902 !!options
11903 parsoid
11904 !!input
11905 <span><s>x</span></s>
11906 !!result
11907 <p><span><s>x</s></span><s></s>
11908 </p>
11909 !!end
11910
11911 ###
11912 ### Language variants related tests
11913 ###
11914 !! test
11915 Self-link in language variants
11916 !! options
11917 title=[[Dunav]] language=sr
11918 !! input
11919 Both [[Dunav]] and [[Дунав]] are names for this river.
11920 !! result
11921 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11922 </p>
11923 !!end
11924
11925 !! article
11926 Дуна
11927 !! text
11928 content
11929 !! endarticle
11930
11931 !! test
11932 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11933 !! options
11934 title=[[Duna]] language=sr
11935 !! input
11936 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11937 !! result
11938 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <strong class="selflink">Duna</strong> and <strong class="selflink">Dуна</strong> are still self-links.
11939 </p>
11940 !! end
11941
11942 !! test
11943 Link to pages in language variants
11944 !! options
11945 language=sr
11946 !! input
11947 Main Page can be written as [[Маин Паге]]
11948 !! result
11949 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11950 </p>
11951 !!end
11952
11953
11954 !! test
11955 Multiple links to pages in language variants
11956 !! options
11957 language=sr
11958 !! input
11959 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11960 !! result
11961 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>.
11962 </p>
11963 !!end
11964
11965
11966 !! test
11967 Simple template in language variants
11968 !! options
11969 language=sr
11970 !! input
11971 {{тест}}
11972 !! result
11973 <p>This is a test template
11974 </p>
11975 !! end
11976
11977
11978 !! test
11979 Template with explicit namespace in language variants
11980 !! options
11981 language=sr
11982 !! input
11983 {{Template:тест}}
11984 !! result
11985 <p>This is a test template
11986 </p>
11987 !! end
11988
11989
11990 !! test
11991 Basic test for template parameter in language variants
11992 !! options
11993 language=sr
11994 !! input
11995 {{парамтест|param=foo}}
11996 !! result
11997 <p>This is a test template with parameter foo
11998 </p>
11999 !! end
12000
12001
12002 !! test
12003 Simple category in language variants
12004 !! options
12005 language=sr cat
12006 !! input
12007 [[Category:МедиаWики Усер'с Гуиде]]
12008 !! result
12009 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
12010 !! end
12011
12012
12013 !! article
12014 Category:分类
12015 !! text
12016 blah
12017 !! endarticle
12018
12019 !! article
12020 Category:分類
12021 !! text
12022 blah
12023 !! endarticle
12024
12025 !! test
12026 Don't convert blue categorylinks to another variant (bug 33210)
12027 !! options
12028 language=zh cat
12029 !! input
12030 [[A]][[Category:分类]]
12031 !! result
12032 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12033 !! end
12034
12035
12036 !! test
12037 Stripping -{}- tags (language variants)
12038 !! options
12039 language=sr
12040 !! input
12041 Latin proverb: -{Ne nuntium necare}-
12042 !! result
12043 <p>Latin proverb: Ne nuntium necare
12044 </p>
12045 !! end
12046
12047
12048 !! test
12049 Prevent conversion with -{}- tags (language variants)
12050 !! options
12051 language=sr variant=sr-ec
12052 !! input
12053 Latinski: -{Ne nuntium necare}-
12054 !! result
12055 <p>Латински: Ne nuntium necare
12056 </p>
12057 !! end
12058
12059
12060 !! test
12061 Prevent conversion of text with -{}- tags (language variants)
12062 !! options
12063 language=sr variant=sr-ec
12064 !! input
12065 Latinski: -{Ne nuntium necare}-
12066 !! result
12067 <p>Латински: Ne nuntium necare
12068 </p>
12069 !! end
12070
12071
12072 !! test
12073 Prevent conversion of links with -{}- tags (language variants)
12074 !! options
12075 language=sr variant=sr-ec
12076 !! input
12077 -{[[Main Page]]}-
12078 !! result
12079 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12080 </p>
12081 !! end
12082
12083
12084 !! test
12085 -{}- tags within headlines (within html for parserConvert())
12086 !! options
12087 language=sr variant=sr-ec
12088 !! input
12089 == -{Naslov}- ==
12090 !! result
12091 <h2><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a>]</span></h2>
12092
12093 !! end
12094
12095
12096 !! test
12097 Explicit definition of language variant alternatives
12098 !! options
12099 language=zh variant=zh-tw
12100 !! input
12101 -{zh:China;zh-tw:Taiwan}-, not China
12102 !! result
12103 <p>Taiwan, not China
12104 </p>
12105 !! end
12106
12107
12108 !! test
12109 Conversion around HTML tags
12110 !! options
12111 language=sr variant=sr-ec
12112 !! input
12113 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12114 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12115 !! result
12116 <p>
12117 <span title="ЛаCтин">ски</span>
12118 </p>
12119 !! end
12120
12121
12122 !! test
12123 Explicit session-wise language variant mapping (A flag and - flag)
12124 !! options
12125 language=zh variant=zh-tw
12126 !! input
12127 Taiwan is not China.
12128 But -{A|zh:China;zh-tw:Taiwan}- is China,
12129 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12130 and -{China}- is China.
12131 !! result
12132 <p>Taiwan is not China.
12133 But Taiwan is Taiwan,
12134 (This should be stripped!)
12135 and China is China.
12136 </p>
12137 !! end
12138
12139 !! test
12140 Explicit session-wise language variant mapping (H flag for hide)
12141 !! options
12142 language=zh variant=zh-tw
12143 !! input
12144 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12145 Taiwan is China.
12146 !! result
12147 <p>(This should be stripped!)
12148 Taiwan is Taiwan.
12149 </p>
12150 !! end
12151
12152 !! test
12153 Adding explicit conversion rule for title (T flag)
12154 !! options
12155 language=zh variant=zh-tw showtitle
12156 !! input
12157 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12158 !! result
12159 Taiwan
12160 <p>Should be stripped!
12161 </p>
12162 !! end
12163
12164 !! test
12165 Testing that changing the language variant here in the tests actually works
12166 !! options
12167 language=zh variant=zh showtitle
12168 !! input
12169 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12170 !! result
12171 China
12172 <p>Should be stripped!
12173 </p>
12174 !! end
12175
12176 !! test
12177 Recursive conversion of alt and title attrs shouldn't clear converter state
12178 !! options
12179 language=zh variant=zh-cn showtitle
12180 !! input
12181 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12182 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12183 !! result
12184 China
12185 <p>
12186 Should be stripped<span title="Exclamation">!</span>
12187 </p>
12188 !! end
12189
12190 !! test
12191 Bug 24072: more test on conversion rule for title
12192 !! options
12193 language=zh variant=zh-tw showtitle
12194 !! input
12195 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12196 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12197 !! result
12198 Taiwan
12199 <p>This should be stripped!
12200 This won't take interferes with the title rule.
12201 </p>
12202 !! end
12203
12204 !! test
12205 Partly disable title conversion if variant == main language code
12206 !! options
12207 language=zh variant=zh title=[[ZH]] showtitle
12208 !! input
12209 -{T|zh-cn:CN;zh-tw:TW}-
12210 !! result
12211 ZH
12212 <p>
12213 </p>
12214 !! end
12215
12216 !! test
12217 Partly disable title conversion if variant == main language code, more
12218 !! options
12219 language=zh variant=zh title=[[ZH]] showtitle
12220 !! input
12221 -{T|TW}-
12222 !! result
12223 ZH
12224 <p>
12225 </p>
12226 !! end
12227
12228 !! test
12229 Raw output of variant escape tags (R flag)
12230 !! options
12231 language=zh variant=zh-tw
12232 !! input
12233 Raw: -{R|zh:China;zh-tw:Taiwan}-
12234 !! result
12235 <p>Raw: zh:China;zh-tw:Taiwan
12236 </p>
12237 !! end
12238
12239 !! test
12240 Nested using of manual convert syntax
12241 !! options
12242 language=zh variant=zh-hk
12243 !! input
12244 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12245 !! result
12246 <p>Nested: Hello Hong Kong!
12247 </p>
12248 !! end
12249
12250 !! test
12251 Proper conversion of text in external links
12252 !! options
12253 language=sr variant=sr-ec
12254 !! input
12255 http://www.google.com
12256 gopher://www.google.com
12257 [http://www.google.com http://www.google.com]
12258 [gopher://www.google.com gopher://www.google.com]
12259 [https://www.google.com irc://www.google.com]
12260 [ftp://www.google.com www.google.com/ftp://dir]
12261 [//www.google.com www.google.com]
12262 !! result
12263 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12264 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12265 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12266 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12267 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12268 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12269 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12270 </p>
12271 !! end
12272
12273 !! test
12274 Do not convert roman numbers to language variants
12275 !! options
12276 language=sr variant=sr-ec
12277 !! input
12278 Fridrih IV je car.
12279 !! result
12280 <p>Фридрих IV је цар.
12281 </p>
12282 !! end
12283
12284 !! test
12285 Unclosed language converter markup "-{"
12286 !! options
12287 language=sr
12288 !! input
12289 -{T|hello
12290 !! result
12291 <p>-{T|hello
12292 </p>
12293 !! end
12294
12295 !! test
12296 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12297 !! options
12298 language=sr
12299 !! input
12300 -{R|=&gt;}-
12301 !! result
12302 <p>=&gt;
12303 </p>
12304 !!end
12305
12306 !!article
12307 Template:Bullet
12308 !!text
12309 * Bar
12310 !!endarticle
12311
12312 !! test
12313 Bug 529: Uncovered bullet
12314 !! input
12315 * Foo {{bullet}}
12316 !! result
12317 <ul><li> Foo
12318 </li><li> Bar
12319 </li></ul>
12320
12321 !! end
12322
12323 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12324 # Templates in Wikipedia rely on this behavior, as tidy has always been
12325 # enabled there. These tests are normally run *without* tidy, so specify the
12326 # full output here.
12327 # To test realistic parsing behavior, apply a tidy-like transformation to both
12328 # the expected output and your parser's output.
12329 !! test
12330 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12331 !! input
12332 ******* Foo {{bullet}}
12333 !! result
12334 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
12335 </li></ul>
12336 </li></ul>
12337 </li></ul>
12338 </li></ul>
12339 </li></ul>
12340 </li></ul>
12341 </li><li> Bar
12342 </li></ul>
12343
12344 !! end
12345
12346 !! test
12347 Bug 529: Uncovered table already at line-start
12348 !! input
12349 x
12350
12351 {{table}}
12352 y
12353 !! result
12354 <p>x
12355 </p>
12356 <table>
12357 <tr>
12358 <td> 1 </td>
12359 <td> 2
12360 </td></tr>
12361 <tr>
12362 <td> 3 </td>
12363 <td> 4
12364 </td></tr></table>
12365 <p>y
12366 </p>
12367 !! end
12368
12369 !! test
12370 Bug 529: Uncovered bullet in parser function result
12371 !! input
12372 * Foo {{lc:{{bullet}} }}
12373 !! result
12374 <ul><li> Foo
12375 </li><li> bar
12376 </li></ul>
12377
12378 !! end
12379
12380 !! test
12381 Bug 5678: Double-parsed template argument
12382 !! input
12383 {{lc:{{{1}}}|hello}}
12384 !! result
12385 <p>{{{1}}}
12386 </p>
12387 !! end
12388
12389 !! test
12390 Bug 5678: Double-parsed template invocation
12391 !! input
12392 {{lc:{{paramtest {{!}} param = hello }} }}
12393 !! result
12394 <p>{{paramtest | param = hello }}
12395 </p>
12396 !! end
12397
12398 !! test
12399 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12400 !! options
12401 language=cs
12402 title=[[Main Page]]
12403 !! input
12404 {{PRVNÍVELKÉ:ěščř}}
12405 {{prvnívelké:ěščř}}
12406 {{PRVNÍMALÉ:ěščř}}
12407 {{prvnímalé:ěščř}}
12408 {{MALÁ:ěščř}}
12409 {{malá:ěščř}}
12410 {{VELKÁ:ěščř}}
12411 {{velká:ěščř}}
12412 !! result
12413 <p>Ěščř
12414 Ěščř
12415 ěščř
12416 ěščř
12417 ěščř
12418 ěščř
12419 ĚŠČŘ
12420 ĚŠČŘ
12421 </p>
12422 !! end
12423
12424 !! test
12425 Morwen/13: Unclosed link followed by heading
12426 !! input
12427 [[link
12428 ==heading==
12429 !! result
12430 <p>[[link
12431 </p>
12432 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span></h2>
12433
12434 !! end
12435
12436 !! test
12437 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12438 !! input
12439 {{foo|
12440 =heading=
12441 !! result
12442 <p>{{foo|
12443 </p>
12444 <h1><span class="mw-headline" id="heading">heading</span></h1>
12445
12446 !! end
12447
12448 !! test
12449 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12450 !! input
12451 {{foo|
12452 ==heading==
12453 !! result
12454 <p>{{foo|
12455 </p>
12456 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span></h2>
12457
12458 !! end
12459
12460 !! test
12461 Tildes in comments
12462 !! options
12463 pst
12464 !! input
12465 <!-- ~~~~ -->
12466 !! result
12467 <!-- ~~~~ -->
12468 !! end
12469
12470 !! test
12471 Paragraphs inside divs (no extra line breaks)
12472 !! input
12473 <div>Line one
12474
12475 Line two</div>
12476 !! result
12477 <div>Line one
12478 Line two</div>
12479
12480 !! end
12481
12482 !! test
12483 Paragraphs inside divs (extra line break on open)
12484 !! input
12485 <div>
12486 Line one
12487
12488 Line two</div>
12489 !! result
12490 <div>
12491 <p>Line one
12492 </p>
12493 Line two</div>
12494
12495 !! end
12496
12497 !! test
12498 Paragraphs inside divs (extra line break on close)
12499 !! input
12500 <div>Line one
12501
12502 Line two
12503 </div>
12504 !! result
12505 <div>Line one
12506 <p>Line two
12507 </p>
12508 </div>
12509
12510 !! end
12511
12512 !! test
12513 Paragraphs inside divs (extra line break on open and close)
12514 !! input
12515 <div>
12516 Line one
12517
12518 Line two
12519 </div>
12520 !! result
12521 <div>
12522 <p>Line one
12523 </p><p>Line two
12524 </p>
12525 </div>
12526
12527 !! end
12528
12529 !! test
12530 Nesting tags, paragraphs on lines which begin with <div>
12531 !! options
12532 disabled
12533 !! input
12534 <div></div><strong>A
12535 B</strong>
12536 !! result
12537 <div></div>
12538 <p><strong>A
12539 B</strong>
12540 </p>
12541 !! end
12542
12543 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12544 !! test
12545 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12546 !! options
12547 disabled
12548 !! input
12549 <blockquote>Line one
12550
12551 Line two</blockquote>
12552 !! result
12553 <blockquote>Line one
12554 Line two</blockquote>
12555
12556 !! end
12557
12558 !! test
12559 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12560 !! options
12561 disabled
12562 !! input
12563 <blockquote>
12564 Line one
12565
12566 Line two</blockquote>
12567 !! result
12568 <blockquote>
12569 <p>Line one
12570 </p>
12571 Line two</blockquote>
12572
12573 !! end
12574
12575 !! test
12576 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12577 !! options
12578 disabled
12579 !! input
12580 <blockquote>Line one
12581
12582 Line two
12583 </blockquote>
12584 !! result
12585 <blockquote>Line one
12586 <p>Line two
12587 </p>
12588 </blockquote>
12589
12590 !! end
12591
12592 !! test
12593 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12594 !! options
12595 disabled
12596 !! input
12597 <blockquote>
12598 Line one
12599
12600 Line two
12601 </blockquote>
12602 !! result
12603 <blockquote>
12604 <p>Line one
12605 </p><p>Line two
12606 </p>
12607 </blockquote>
12608
12609 !! end
12610
12611 !! test
12612 Paragraphs inside blockquotes/divs (no extra line breaks)
12613 !! input
12614 <blockquote><div>Line one
12615
12616 Line two</div></blockquote>
12617 !! result
12618 <blockquote><div>Line one
12619 Line two</div></blockquote>
12620
12621 !! end
12622
12623 !! test
12624 Paragraphs inside blockquotes/divs (extra line break on open)
12625 !! input
12626 <blockquote><div>
12627 Line one
12628
12629 Line two</div></blockquote>
12630 !! result
12631 <blockquote><div>
12632 <p>Line one
12633 </p>
12634 Line two</div></blockquote>
12635
12636 !! end
12637
12638 !! test
12639 Paragraphs inside blockquotes/divs (extra line break on close)
12640 !! input
12641 <blockquote><div>Line one
12642
12643 Line two
12644 </div></blockquote>
12645 !! result
12646 <blockquote><div>Line one
12647 <p>Line two
12648 </p>
12649 </div></blockquote>
12650
12651 !! end
12652
12653 !! test
12654 Paragraphs inside blockquotes/divs (extra line break on open and close)
12655 !! input
12656 <blockquote><div>
12657 Line one
12658
12659 Line two
12660 </div></blockquote>
12661 !! result
12662 <blockquote><div>
12663 <p>Line one
12664 </p><p>Line two
12665 </p>
12666 </div></blockquote>
12667
12668 !! end
12669
12670 !! test
12671 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12672 !! options
12673 wgLinkHolderBatchSize=0
12674 !! input
12675 [[meatball:1]]
12676 [[meatball:2]]
12677 [[meatball:3]]
12678 !! result
12679 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
12680 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
12681 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
12682 </p>
12683 !! end
12684
12685 !! test
12686 Free external link invading image caption
12687 !! input
12688 [[Image:Foobar.jpg|thumb|http://x|hello]]
12689 !! result
12690 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
12691
12692 !! end
12693
12694 !! test
12695 Bug 15196: localised external link numbers
12696 !! options
12697 language=fa
12698 !! input
12699 [http://en.wikipedia.org/]
12700 !! result
12701 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
12702 </p>
12703 !! end
12704
12705 !! test
12706 Multibyte character in padleft
12707 !! input
12708 {{padleft:-Hello|7|Æ}}
12709 !! result
12710 <p>Æ-Hello
12711 </p>
12712 !! end
12713
12714 !! test
12715 Multibyte character in padright
12716 !! input
12717 {{padright:Hello-|7|Æ}}
12718 !! result
12719 <p>Hello-Æ
12720 </p>
12721 !! end
12722
12723 !!test
12724 formatdate parser function
12725 !!input
12726 {{#formatdate:2009-03-24}}
12727 !! result
12728 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
12729 </p>
12730 !! end
12731
12732 !!test
12733 formatdate parser function, with default format
12734 !!input
12735 {{#formatdate:2009-03-24|mdy}}
12736 !! result
12737 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
12738 </p>
12739 !! end
12740
12741 !! test
12742 Spacing of numbers in formatted dates
12743 !! input
12744 {{#formatdate:January 15}}
12745 !! result
12746 <p><span class="mw-formatted-date" title="01-15">January 15</span>
12747 </p>
12748 !! end
12749
12750 !! test
12751 formatdate parser function, with default format and on a page of which the content language is always English and different from the wiki content language
12752 !! options
12753 language=nl title=[[MediaWiki:Common.css]]
12754 !! input
12755 {{#formatdate:2009-03-24|dmy}}
12756 !! result
12757 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
12758 </p>
12759 !! end
12760
12761 #
12762 #
12763 #
12764
12765 #
12766 # Edit comments
12767 #
12768
12769 !! test
12770 Edit comment with link
12771 !! options
12772 comment
12773 !! input
12774 I like the [[Main Page]] a lot
12775 !! result
12776 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12777 !!end
12778
12779 !! test
12780 Edit comment with link and link text
12781 !! options
12782 comment
12783 !! input
12784 I like the [[Main Page|best pages]] a lot
12785 !! result
12786 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12787 !!end
12788
12789 !! test
12790 Edit comment with link and link text with suffix
12791 !! options
12792 comment
12793 !! input
12794 I like the [[Main Page|best page]]s a lot
12795 !! result
12796 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12797 !!end
12798
12799 !! test
12800 Edit comment with section link (non-local, eg in history list)
12801 !! options
12802 comment title=[[Main Page]]
12803 !! input
12804 /* External links */ removed bogus entries
12805 !! result
12806 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12807 !!end
12808
12809 !! test
12810 Edit comment with section link and text before it (non-local, eg in history list)
12811 !! options
12812 comment title=[[Main Page]]
12813 !! input
12814 pre-comment text /* External links */ removed bogus entries
12815 !! result
12816 pre-comment text - <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12817 !!end
12818
12819 !! test
12820 Edit comment with section link (local, eg in diff view)
12821 !! options
12822 comment local title=[[Main Page]]
12823 !! input
12824 /* External links */ removed bogus entries
12825 !! result
12826 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12827 !!end
12828
12829 !! test
12830 Edit comment with subpage link (bug 14080)
12831 !! options
12832 comment
12833 subpage
12834 title=[[Subpage test]]
12835 !! input
12836 Poked at a [[/subpage]] here...
12837 !! result
12838 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12839 !!end
12840
12841 !! test
12842 Edit comment with subpage link and link text (bug 14080)
12843 !! options
12844 comment
12845 subpage
12846 title=[[Subpage test]]
12847 !! input
12848 Poked at a [[/subpage|neat little page]] here...
12849 !! result
12850 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12851 !!end
12852
12853 !! test
12854 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12855 !! options
12856 comment
12857 title=[[Subpage test]]
12858 !! input
12859 Poked at a [[/subpage]] here...
12860 !! result
12861 Poked at a <a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> here...
12862 !!end
12863
12864 !! test
12865 Edit comment with bare anchor link (local, as on diff)
12866 !! options
12867 comment
12868 local
12869 title=[[Main Page]]
12870 !!input
12871 [[#section]]
12872 !! result
12873 <a href="#section">#section</a>
12874 !! end
12875
12876 !! test
12877 Edit comment with bare anchor link (non-local, as on history)
12878 !! options
12879 comment
12880 title=[[Main Page]]
12881 !!input
12882 [[#section]]
12883 !! result
12884 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12885 !! end
12886
12887 !! test
12888 Anchor starting with underscore
12889 !!input
12890 [[#_ref|One]]
12891 !! result
12892 <p><a href="#_ref">One</a>
12893 </p>
12894 !! end
12895
12896 !! test
12897 Id starting with underscore
12898 !!input
12899 <div id="_ref"></div>
12900 !! result
12901 <div id="_ref"></div>
12902
12903 !! end
12904
12905 !! test
12906 Space normalisation on autocomment (bug 22784)
12907 !! options
12908 comment
12909 title=[[Main Page]]
12910 !!input
12911 /* __hello__world__ */
12912 !! result
12913 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12914 !! end
12915
12916 !! test
12917 percent-encoding and + signs in comments (Bug 26410)
12918 !! options
12919 comment
12920 !!input
12921 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12922 !! result
12923 <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">ABC3D% ++</a> <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">+%20</a>
12924 !! end
12925
12926 !! test
12927 Bad images - basic functionality
12928 !! options
12929 disabled
12930 !! input
12931 [[File:Bad.jpg]]
12932 !! result
12933 !! end
12934
12935 !! test
12936 Bad images - bug 16039: text after bad image disappears
12937 !! options
12938 disabled
12939 !! input
12940 Foo bar
12941 [[File:Bad.jpg]]
12942 Bar foo
12943 !! result
12944 <p>Foo bar
12945 </p><p>Bar foo
12946 </p>
12947 !! end
12948
12949 !! test
12950 Verify that displaytitle works (bug #22501) no displaytitle
12951 !! options
12952 showtitle
12953 !! config
12954 wgAllowDisplayTitle=true
12955 wgRestrictDisplayTitle=false
12956 !! input
12957 this is not the the title
12958 !! result
12959 Parser test
12960 <p>this is not the the title
12961 </p>
12962 !! end
12963
12964 !! test
12965 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12966 !! options
12967 showtitle
12968 title=[[Screen]]
12969 !! config
12970 wgAllowDisplayTitle=true
12971 wgRestrictDisplayTitle=false
12972 !! input
12973 this is not the the title
12974 {{DISPLAYTITLE:whatever}}
12975 !! result
12976 whatever
12977 <p>this is not the the title
12978 </p>
12979 !! end
12980
12981 !! test
12982 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12983 !! options
12984 showtitle
12985 title=[[Screen]]
12986 !! config
12987 wgAllowDisplayTitle=true
12988 wgRestrictDisplayTitle=true
12989 !! input
12990 this is not the the title
12991 {{DISPLAYTITLE:whatever}}
12992 !! result
12993 Screen
12994 <p>this is not the the title
12995 </p>
12996 !! end
12997
12998 !! test
12999 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
13000 !! options
13001 showtitle
13002 title=[[Screen]]
13003 !! config
13004 wgAllowDisplayTitle=true
13005 wgRestrictDisplayTitle=true
13006 !! input
13007 this is not the the title
13008 {{DISPLAYTITLE:screen}}
13009 !! result
13010 screen
13011 <p>this is not the the title
13012 </p>
13013 !! end
13014
13015 !! test
13016 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
13017 !! options
13018 showtitle
13019 title=[[Screen]]
13020 !! config
13021 wgAllowDisplayTitle=false
13022 !! input
13023 this is not the the title
13024 {{DISPLAYTITLE:screen}}
13025 !! result
13026 Screen
13027 <p>this is not the the title
13028 <a href="/index.php?title=Template:DISPLAYTITLE:screen&amp;action=edit&amp;redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a>
13029 </p>
13030 !! end
13031
13032 !! test
13033 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13034 !! options
13035 showtitle
13036 title=[[Screen]]
13037 !! config
13038 wgAllowDisplayTitle=false
13039 !! input
13040 this is not the the title
13041 !! result
13042 Screen
13043 <p>this is not the the title
13044 </p>
13045 !! end
13046
13047 !! test
13048 preload: check <noinclude> and <includeonly>
13049 !! options
13050 preload
13051 !! input
13052 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13053 !! result
13054 Hello kind world.
13055 !! end
13056
13057 !! test
13058 preload: check <onlyinclude>
13059 !! options
13060 preload
13061 !! input
13062 Goodbye <onlyinclude>Hello world</onlyinclude>
13063 !! result
13064 Hello world
13065 !! end
13066
13067 !! test
13068 preload: can pass tags through if we want to
13069 !! options
13070 preload
13071 !! input
13072 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13073 !! result
13074 <includeonly>Hello world</includeonly>
13075 !! end
13076
13077 !! test
13078 preload: check that it doesn't try to do tricks
13079 !! options
13080 preload
13081 !! input
13082 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13083 !! result
13084 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13085 !! end
13086
13087 !! test
13088 Play a bit with r67090 and bug 3158
13089 !! options
13090 disabled
13091 !! input
13092 <div style="width:50% !important">&nbsp;</div>
13093 <div style="width:50%&nbsp;!important">&nbsp;</div>
13094 <div style="width:50%&#160;!important">&nbsp;</div>
13095 <div style="border : solid;">&nbsp;</div>
13096 !! result
13097 <div style="width:50% !important">&nbsp;</div>
13098 <div style="width:50% !important">&nbsp;</div>
13099 <div style="width:50% !important">&nbsp;</div>
13100 <div style="border&#160;: solid;">&nbsp;</div>
13101
13102 !! end
13103
13104 !! test
13105 HTML5 data attributes
13106 !! input
13107 <span data-foo="bar">Baz</span>
13108 <p data-abc-def_hij="">Quuz</p>
13109 !! result
13110 <p><span data-foo="bar">Baz</span>
13111 </p>
13112 <p data-abc-def_hij="">Quuz</p>
13113
13114 !! end
13115
13116 !! test
13117 percent-encoding and + signs in internal links (Bug 26410)
13118 !! input
13119 [[User:+%]] [[Page+title%]]
13120 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13121 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13122 [[%33%45]] [[%33%45+]]
13123 !! result
13124 <p><a href="/index.php?title=User:%2B%25&amp;action=edit&amp;redlink=1" class="new" title="User:+% (page does not exist)">User:+%</a> <a href="/index.php?title=Page%2Btitle%25&amp;action=edit&amp;redlink=1" class="new" title="Page+title% (page does not exist)">Page+title%</a>
13125 <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%20</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+ </a> <a href="/index.php?title=%25%2Br&amp;action=edit&amp;redlink=1" class="new" title="%+r (page does not exist)">%+r</a>
13126 <a href="/index.php?title=%25&amp;action=edit&amp;redlink=1" class="new" title="% (page does not exist)">%</a> <a href="/index.php?title=%2B&amp;action=edit&amp;redlink=1" class="new" title="+ (page does not exist)">+</a> <a href="/index.php?title=Special:Upload&amp;wpDestFile=%25%2Babc9" class="new" title="File:%+abc9">bar</a>
13127 <a href="/index.php?title=3E&amp;action=edit&amp;redlink=1" class="new" title="3E (page does not exist)">3E</a> <a href="/index.php?title=3E%2B&amp;action=edit&amp;redlink=1" class="new" title="3E+ (page does not exist)">3E+</a>
13128 </p>
13129 !! end
13130
13131 !! test
13132 Special characters in embedded file links (bug 27679)
13133 !! input
13134 [[File:Contains & ampersand.jpg]]
13135 [[File:Does not exist.jpg|Title with & ampersand]]
13136 !! result
13137 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Contains_%26_ampersand.jpg" class="new" title="File:Contains &amp; ampersand.jpg">File:Contains &amp; ampersand.jpg</a>
13138 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Does_not_exist.jpg" class="new" title="File:Does not exist.jpg">Title with &amp; ampersand</a>
13139 </p>
13140 !! end
13141
13142
13143 !! test
13144 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13145 !! input
13146 Text&apos;s been normalized?
13147 !! result
13148 <p>Text&#39;s been normalized?
13149 </p>
13150 !! end
13151
13152 !! test
13153 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13154 !! input
13155 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13156 !! result
13157 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13158 </p>
13159 !! end
13160
13161 !! test
13162 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13163 !! input
13164 [http://www.example.org/ ideograms]
13165 !! result
13166 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13167 </p>
13168 !! end
13169
13170 !! test
13171 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13172 !! input
13173 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13174 !! result
13175 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13176 </p>
13177 !! end
13178
13179 !! article
13180 Mediawiki:loop1
13181 !! text
13182 {{Identical|A}}
13183 !! endarticle
13184
13185 !! article
13186 Mediawiki:loop2
13187 !! text
13188 {{Identical|B}}
13189 !! endarticle
13190
13191 !! article
13192 Template:Identical
13193 !! text
13194 {{int:loop1}}
13195 {{int:loop2}}
13196 !! endarticle
13197
13198 !! test
13199 Bug 31098 Template which includes system messages which includes the template
13200 !! input
13201 {{Identical}}
13202 !! result
13203 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13204 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13205 </p>
13206 !! end
13207
13208 !! test
13209 Bug31490 Turkish: ucfirst 'blah'
13210 !! options
13211 language=tr
13212 !! input
13213 {{ucfirst:blah}}
13214 !! result
13215 <p>Blah
13216 </p>
13217 !! end
13218
13219 !! test
13220 Bug31490 Turkish: ucfirst 'ix'
13221 !! options
13222 language=tr
13223 !! input
13224 {{ucfirst:ix}}
13225 !! result
13226 <p>İx
13227 </p>
13228 !! end
13229
13230 !! test
13231 Bug31490 Turkish: lcfirst 'BLAH'
13232 !! options
13233 language=tr
13234 !! input
13235 {{lcfirst:BLAH}}
13236 !! result
13237 <p>bLAH
13238 </p>
13239 !! end
13240
13241 !! test
13242 Bug31490 Turkish: ucfırst (with a dotless i)
13243 !! options
13244 language=tr
13245 !! input
13246 {{ucfırst:blah}}
13247 !! result
13248 <p><a href="/index.php?title=%C5%9Eablon:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Şablon:Ucfırst:blah (sayfa mevcut değil)">Şablon:Ucfırst:blah</a>
13249 </p>
13250 !! end
13251
13252 !! test
13253 Bug31490 ucfırst (with a dotless i) with English language
13254 !! options
13255 language=en
13256 !! input
13257 {{ucfırst:blah}}
13258 !! result
13259 <p><a href="/index.php?title=Template:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Template:Ucfırst:blah (page does not exist)">Template:Ucfırst:blah</a>
13260 </p>
13261 !! end
13262
13263 !! test
13264 Bug 26375: TOC with italics
13265 !! options
13266 title=[[Main Page]]
13267 !! input
13268 __TOC__
13269 == ''Lost'' episodes ==
13270 !! result
13271 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13272 <ul>
13273 <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
13274 </ul>
13275 </td></tr></table>
13276 <h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a>]</span></h2>
13277
13278 !! end
13279
13280 !! test
13281 Bug 26375: TOC with bold
13282 !! options
13283 title=[[Main Page]]
13284 !! input
13285 __TOC__
13286 == '''should be bold''' then normal text ==
13287 !! result
13288 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13289 <ul>
13290 <li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
13291 </ul>
13292 </td></tr></table>
13293 <h2><span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: should be bold then normal text">edit</a>]</span></h2>
13294
13295 !! end
13296
13297 !! test
13298 Bug 33845: Headings become cursive in TOC when they contain an image
13299 !! options
13300 title=[[Main Page]]
13301 !! input
13302 __TOC__
13303 == Image [[Image:foobar.jpg]] ==
13304 !! result
13305 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13306 <ul>
13307 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13308 </ul>
13309 </td></tr></table>
13310 <h2><span class="mw-headline" id="Image">Image <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a>]</span></h2>
13311
13312 !! end
13313
13314 !! test
13315 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13316 !! options
13317 title=[[Main Page]]
13318 !! input
13319 __TOC__
13320 == <blockquote>Quote</blockquote> ==
13321 !! result
13322 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13323 <ul>
13324 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13325 </ul>
13326 </td></tr></table>
13327 <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a>]</span></h2>
13328
13329 !! end
13330
13331 !! test
13332 Unclosed tags in TOC
13333 !! options
13334 title=[[Main Page]]
13335 !! input
13336 __TOC__
13337 == Proof: 2 < 3 ==
13338 <small>Hanc marginis exiguitas non caperet.</small>
13339 QED
13340 !! result
13341 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13342 <ul>
13343 <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
13344 </ul>
13345 </td></tr></table>
13346 <h2><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a>]</span></h2>
13347 <p><small>Hanc marginis exiguitas non caperet.</small>
13348 QED
13349 </p>
13350 !! end
13351
13352 !! test
13353 Multiple tags in TOC
13354 !! input
13355 __TOC__
13356 == <i>Foo</i> <b>Bar</b> ==
13357
13358 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13359 !! result
13360 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13361 <ul>
13362 <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
13363 <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
13364 </ul>
13365 </td></tr></table>
13366 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a>]</span></h2>
13367 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span></h2>
13368
13369 !! end
13370
13371 !! test
13372 Tags with parameters in TOC
13373 !! input
13374 __TOC__
13375 == <sup class="in-h2">Hello</sup> ==
13376
13377 == <sup class="a > b">Evilbye</sup> ==
13378 !! result
13379 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13380 <ul>
13381 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13382 <li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b"&gt;Evilbye</sup></span></a></li>
13383 </ul>
13384 </td></tr></table>
13385 <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a>]</span></h2>
13386 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a>]</span></h2>
13387
13388 !! end
13389
13390 !! test
13391 span tags with directionality in TOC
13392 !! input
13393 __TOC__
13394 == <span dir="ltr">C++</span> ==
13395
13396 == <span dir="rtl">זבנג!</span> ==
13397
13398 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13399
13400 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13401
13402 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13403 !! result
13404 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13405 <ul>
13406 <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
13407 <li class="toclevel-1 tocsection-2"><a href="#.D7.96.D7.91.D7.A0.D7.92.21"><span class="tocnumber">2</span> <span class="toctext"><span dir="rtl">זבנג!</span></span></a></li>
13408 <li class="toclevel-1 tocsection-3"><a href="#The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">3</span> <span class="toctext"><span>The attributes on these span tags must be deleted from the TOC</span></span></a></li>
13409 <li class="toclevel-1 tocsection-4"><a href="#All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">4</span> <span class="toctext"><span>All attributes on these span tags must be deleted from the TOC</span></span></a></li>
13410 <li class="toclevel-1 tocsection-5"><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">5</span> <span class="toctext"><span dir="ltr">Attributes after dir on these span tags must be deleted from the TOC</span></span></a></li>
13411 </ul>
13412 </td></tr></table>
13413 <h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a>]</span></h2>
13414 <h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a>]</span></h2>
13415 <h2><span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13416 <h2><span class="mw-headline" id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: All attributes on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13417 <h2><span class="mw-headline" id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Attributes after dir on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13418
13419 !! end
13420
13421 !! article
13422 MediaWiki:Bug32057
13423 !! text
13424 == {{int:headline_sample}} ==
13425 !! endarticle
13426
13427 !! test
13428 Bug 32057: Title needed when expanding <h> nodes.
13429 !! options
13430 title=[[Main Page]]
13431 !! input
13432 {{int:Bug32057}}
13433 !! result
13434 <h2><span class="mw-headline" id="Headline_text">Headline text</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a>]</span></h2>
13435
13436 !! end
13437
13438 !! test
13439 Strip marker in urlencode
13440 !! input
13441 {{urlencode:x<nowiki/>y}}
13442 {{urlencode:x<nowiki/>y|wiki}}
13443 {{urlencode:x<nowiki/>y|path}}
13444 !! result
13445 <p>xy
13446 xy
13447 xy
13448 </p>
13449 !! end
13450
13451 !! test
13452 Strip marker in lc
13453 !! input
13454 {{lc:x<nowiki/>y}}
13455 !! result
13456 <p>xy
13457 </p>
13458 !! end
13459
13460 !! test
13461 Strip marker in uc
13462 !! input
13463 {{uc:x<nowiki/>y}}
13464 !! result
13465 <p>XY
13466 </p>
13467 !! end
13468
13469 !! test
13470 Strip marker in formatNum
13471 !! input
13472 {{formatnum:1<nowiki/>2}}
13473 {{formatnum:1<nowiki/>2|R}}
13474 !! result
13475 <p>12
13476 12
13477 </p>
13478 !! end
13479
13480 !! test
13481 Check noCommafy in formatNum
13482 !! options
13483 language=be-tarask
13484 !! input
13485 {{formatnum:123456.78}}
13486 {{formatnum:123456.78|NOSEP}}
13487 !! result
13488 <p>123 456,78
13489 123456.78
13490 </p>
13491 !! end
13492
13493 !! test
13494 Strip marker in grammar
13495 !! options
13496 language=fi
13497 !! input
13498 {{grammar:elative|foo<nowiki/>bar}}
13499 !! result
13500 <p>foobarista
13501 </p>
13502 !! end
13503
13504 !! test
13505 Strip marker in padleft
13506 !! input
13507 {{padleft:|2|x<nowiki/>y}}
13508 !! result
13509 <p>xy
13510 </p>
13511 !! end
13512
13513 !! test
13514 Strip marker in padright
13515 !! input
13516 {{padright:|2|x<nowiki/>y}}
13517 !! result
13518 <p>xy
13519 </p>
13520 !! end
13521
13522 !! test
13523 Strip marker in anchorencode
13524 !! input
13525 {{anchorencode:x<nowiki/>y}}
13526 !! result
13527 <p>xy
13528 </p>
13529 !! end
13530
13531 !! test
13532 nowiki inside link inside heading (bug 18295)
13533 !! input
13534 ==[[foo|x<nowiki>y</nowiki>z]]==
13535 !! result
13536 <h2><span class="mw-headline" id="xyz"><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">xyz</a></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a>]</span></h2>
13537
13538 !! end
13539
13540 !! test
13541 new support for bdi element (bug 31817)
13542 !! input
13543 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13544 !! result
13545 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13546
13547 !!end
13548
13549 !! test
13550 Ignore pipe between table row attributes
13551 !! input
13552 {|
13553 | quux
13554 |- id=foo | style='color: red'
13555 | bar
13556 |}
13557 !! result
13558 <table>
13559 <tr>
13560 <td> quux
13561 </td></tr>
13562 <tr id="foo" style="color: red">
13563 <td> bar
13564 </td></tr></table>
13565
13566 !! end
13567
13568 !!test
13569 Gallery override link with WikiLink (bug 34852)
13570 !! input
13571 <gallery>
13572 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13573 </gallery>
13574 !! result
13575 <ul class="gallery">
13576 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13577 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13578 <div class="gallerytext">
13579 <p>caption
13580 </p>
13581 </div>
13582 </div></li>
13583 </ul>
13584
13585 !! end
13586
13587 !!test
13588 Gallery override link with absolute external link (bug 34852)
13589 !! input
13590 <gallery>
13591 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13592 </gallery>
13593 !! result
13594 <ul class="gallery">
13595 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13596 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13597 <div class="gallerytext">
13598 <p>caption
13599 </p>
13600 </div>
13601 </div></li>
13602 </ul>
13603
13604 !! end
13605
13606 !!test
13607 Gallery override link with malicious javascript (bug 34852)
13608 !! input
13609 <gallery>
13610 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13611 </gallery>
13612 !! result
13613 <ul class="gallery">
13614 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13615 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13616 <div class="gallerytext">
13617 <p>caption
13618 </p>
13619 </div>
13620 </div></li>
13621 </ul>
13622
13623 !! end
13624
13625 !!test
13626 Gallery with invalid title as link (bug 43964)
13627 !! input
13628 <gallery>
13629 File:foobar.jpg|link=<
13630 </gallery>
13631 !! result
13632 <ul class="gallery">
13633 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13634 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13635 <div class="gallerytext">
13636 </div>
13637 </div></li>
13638 </ul>
13639
13640 !! end
13641
13642 !!test
13643 Language parser function
13644 !! input
13645 {{#language:ar}}
13646 !! result
13647 <p>العربية
13648 </p>
13649 !! end
13650
13651 !!test
13652 Padleft and padright as substr
13653 !! input
13654 {{padleft:|3|abcde}}
13655 {{padright:|3|abcde}}
13656 !! result
13657 <p>abc
13658 abc
13659 </p>
13660 !! end
13661
13662 !!test
13663 Bug 34939 - Case insensitive link parsing ([HttP://])
13664 !! input
13665 [HttP://MediaWiki.Org/]
13666 !! result
13667 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13668 </p>
13669 !! end
13670
13671 !!test
13672 Bug 34939 - Case insensitive link parsing ([HttP:// title])
13673 !! input
13674 [HttP://MediaWiki.Org/ MediaWiki]
13675 !! result
13676 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13677 </p>
13678 !! end
13679
13680 !!test
13681 Bug 34939 - Case insensitive link parsing (HttP://)
13682 !! input
13683 HttP://MediaWiki.Org/
13684 !! result
13685 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13686 </p>
13687 !! end
13688
13689 ###
13690 ### Parsoids-specific tests
13691 ### Parsoid-PHP parser incompatibilities
13692 ###
13693 !!test
13694 1. SOL-sensitive wikitext tokens as template-args
13695 !!options
13696 parsoid=wt2html,wt2wt
13697 !!input
13698 {{echo|*a}}
13699 {{echo|#a}}
13700 {{echo|:a}}
13701 !!result
13702 <span about="#mwt1" typeof="mw:Object/Template">
13703 </span><ul about="#mwt1"><li>a</li></ul>
13704 <span about="#mwt2" typeof="mw:Object/Template">
13705 </span><ol about="#mwt2"><li>a</li></ol>
13706 <span about="#mwt3" typeof="mw:Object/Template">
13707 </span><dl about="#mwt3"><dd>a</dd></dl>
13708 !!end
13709
13710 #### The following section of tests are primarily to test
13711 #### wikitext escaping capabilities of Parsoid. Given that
13712 #### escaping can be done any number of ways, the wikitext (input)
13713 #### is always adjusted to reflect how Parsoid adds nowiki
13714 #### escape tags.
13715 ####
13716 #### We are marking several tests as parsoid-only since the
13717 #### HTML in the result section is different from what the
13718 #### PHP parser generates for it.
13719
13720
13721 #### --------------- Headings ---------------
13722 #### 0. Unnested
13723 #### 1. Nested inside html <h1>=foo=</h1>
13724 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
13725 #### 3. Nested inside html with wikitext split by html tags
13726 #### 4. No escape needed
13727 #### 5. Empty headings <h1></h1>
13728 #### 6. Heading chars in SOL context
13729 #### ----------------------------------------
13730 !! test
13731 Headings: 0. Unnested
13732 !! options
13733 parsoid
13734 !! input
13735 <nowiki>=foo=</nowiki>
13736
13737 <nowiki> =foo= </nowiki>
13738 <!--cmt-->
13739 <nowiki>=foo=</nowiki>
13740
13741 =foo''a''<nowiki>=</nowiki>
13742 !! result
13743 <p><span typeof="mw:Nowiki">=foo=</span></p>
13744
13745 <p><span typeof="mw:Nowiki"> =foo= </span>
13746 <!--cmt-->
13747 <span typeof="mw:Nowiki">=foo=</span></p>
13748
13749 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
13750 !!end
13751
13752 !! test
13753 Headings: 1. Nested inside html
13754 !! options
13755 parsoid
13756 !! input
13757 =<nowiki>=foo=</nowiki>=
13758 ==<nowiki>=foo=</nowiki>==
13759 ===<nowiki>=foo=</nowiki>===
13760 ====<nowiki>=foo=</nowiki>====
13761 =====<nowiki>=foo=</nowiki>=====
13762 ======<nowiki>=foo=</nowiki>======
13763 !! result
13764 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
13765 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
13766 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
13767 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
13768 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
13769 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
13770 !!end
13771
13772 !! test
13773 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
13774 !! options
13775 parsoid
13776 !! input
13777 =foo=
13778 <nowiki>*bar</nowiki>
13779 =foo=
13780 =bar
13781 =foo=
13782 <nowiki>=bar=</nowiki>
13783 !! result
13784 <h1>foo</h1>*bar
13785 <h1>foo</h1>=bar
13786 <h1>foo</h1>=bar=
13787 !!end
13788
13789 !! test
13790 Headings: 3. Nested inside html with wikitext split by html tags
13791 !! options
13792 parsoid
13793 !! input
13794 =='''bold'''<nowiki>foo=</nowiki>=
13795 !! result
13796 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
13797 !!end
13798
13799 !! test
13800 Headings: 4a. No escaping needed (testing just h1 and h2)
13801 !! options
13802 parsoid
13803 !! input
13804 ==foo=
13805 =foo==
13806 = =foo= =
13807 ==foo= bar=
13808 ===foo==
13809 ==foo===
13810 =''=''foo==
13811 =<nowiki>=</nowiki>=
13812 !! result
13813 <h1>=foo</h1>
13814 <h1>foo=</h1>
13815 <h1> =foo= </h1>
13816 <h1>=foo= bar</h1>
13817 <h2>=foo</h2>
13818 <h2>foo=</h2>
13819 <h1><i>=</i>foo=</h1>
13820 <h1><span typeof="mw:Nowiki">=</span></h1>
13821 !!end
13822
13823 !! test
13824 Headings: 4b. No escaping needed (inside p-tags)
13825 !! options
13826 parsoid
13827 !! input
13828 ===
13829 =foo= x
13830 =foo= <s></s>
13831 !! result
13832 <p>===
13833 =foo= x
13834 =foo= <s></s>
13835 </p>
13836 !!end
13837
13838 !! test
13839 Headings: 5. Empty headings
13840 !! options
13841 parsoid
13842 !! input
13843 =<nowiki/>=
13844 ==<nowiki/>==
13845 ===<nowiki/>===
13846 ====<nowiki/>====
13847 =====<nowiki/>=====
13848 ======<nowiki/>======
13849 !! result
13850 <h1></h1>
13851 <h2></h2>
13852 <h3></h3>
13853 <h4></h4>
13854 <h5></h5>
13855 <h6></h6>
13856 !!end
13857
13858 !! test
13859 Headings: 6. Heading chars in SOL context
13860 !! options
13861 parsoid
13862 !! input
13863 <!--cmt--><nowiki>=h1=</nowiki>
13864 <!--cmt--><nowiki> =h1= </nowiki>
13865 !! result
13866 <p><!--cmt--><span typeof="mw:Nowiki">=h1=</span>
13867 <!--cmt--><span typeof="mw:Nowiki"> =h1= </span></p>
13868 !!end
13869
13870 #### --------------- Lists ---------------
13871 #### 0. Outside nests (*foo, etc.)
13872 #### 1. Nested inside html <ul><li>*foo</li></ul>
13873 #### 2. Inside definition lists
13874 #### 3. Only bullets at start should be escaped
13875 #### 4. No escapes needed
13876 #### 5. No unnecessary escapes
13877 #### 6. Escape bullets in SOL position
13878 #### 7. Escape bullets in a multi-line context
13879 #### ----------------------------------------
13880
13881 !! test
13882 Lists: 0. Outside nests
13883 !! input
13884 <nowiki>*foo</nowiki>
13885
13886 <nowiki>#foo</nowiki>
13887 !! result
13888 <p>*foo
13889 </p><p>#foo
13890 </p>
13891 !!end
13892
13893 !! test
13894 Lists: 1. Nested inside html
13895 !! input
13896 *<nowiki>*foo</nowiki>
13897
13898 *<nowiki>#foo</nowiki>
13899
13900 *<nowiki>:foo</nowiki>
13901
13902 *<nowiki>;foo</nowiki>
13903
13904 #<nowiki>*foo</nowiki>
13905
13906 #<nowiki>#foo</nowiki>
13907
13908 #<nowiki>:foo</nowiki>
13909
13910 #<nowiki>;foo</nowiki>
13911 !! result
13912 <ul><li>*foo
13913 </li></ul>
13914 <ul><li>#foo
13915 </li></ul>
13916 <ul><li>:foo
13917 </li></ul>
13918 <ul><li>;foo
13919 </li></ul>
13920 <ol><li>*foo
13921 </li></ol>
13922 <ol><li>#foo
13923 </li></ol>
13924 <ol><li>:foo
13925 </li></ol>
13926 <ol><li>;foo
13927 </li></ol>
13928
13929 !!end
13930
13931 !! test
13932 Lists: 2. Inside definition lists
13933 !! input
13934 ;<nowiki>;foo</nowiki>
13935
13936 ;<nowiki>:foo</nowiki>
13937
13938 ;<nowiki>:foo</nowiki>
13939 :bar
13940
13941 :<nowiki>:foo</nowiki>
13942 !! result
13943 <dl><dt>;foo
13944 </dt></dl>
13945 <dl><dt>:foo
13946 </dt></dl>
13947 <dl><dt>:foo
13948 </dt><dd>bar
13949 </dd></dl>
13950 <dl><dd>:foo
13951 </dd></dl>
13952
13953 !!end
13954
13955 !! test
13956 Lists: 3. Only bullets at start of text should be escaped
13957 !! input
13958 *<nowiki>*foo*bar</nowiki>
13959
13960 *<nowiki>*foo</nowiki>''it''*bar
13961 !! result
13962 <ul><li>*foo*bar
13963 </li></ul>
13964 <ul><li>*foo<i>it</i>*bar
13965 </li></ul>
13966
13967 !!end
13968
13969 !! test
13970 Lists: 4. No escapes needed
13971 !! options
13972 parsoid
13973 !! input
13974 *foo*bar
13975
13976 *''foo''*bar
13977
13978 *[[Foo]]: bar
13979 !! result
13980 <ul><li>foo*bar
13981 </li></ul>
13982 <ul><li><i>foo</i>*bar
13983 </li></ul>
13984 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
13985 </li></ul>
13986 !!end
13987
13988 !! test
13989 Lists: 5. No unnecessary escapes
13990 !! input
13991 * bar <span><nowiki>[[foo]]</nowiki></span>
13992
13993 *=bar <span><nowiki>[[foo]]</nowiki></span>
13994
13995 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13996
13997 *]]bar <span><nowiki>[[foo]]</nowiki></span>
13998
13999 *=bar <span>foo]]</span>=
14000
14001 * <s></s>: a
14002 !! result
14003 <ul><li> bar <span>[[foo]]</span>
14004 </li></ul>
14005 <ul><li>=bar <span>[[foo]]</span>
14006 </li></ul>
14007 <ul><li>[[bar <span>[[foo]]</span>
14008 </li></ul>
14009 <ul><li>]]bar <span>[[foo]]</span>
14010 </li></ul>
14011 <ul><li>=bar <span>foo]]</span>=
14012 </li></ul>
14013 <ul><li> <s></s>: a
14014 </li></ul>
14015
14016 !!end
14017
14018 !! test
14019 Lists: 6. Escape bullets in SOL position
14020 !! options
14021 parsoid
14022 !! input
14023 <!--cmt--><nowiki>*foo</nowiki>
14024 !! result
14025 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
14026 !!end
14027
14028 !! test
14029 Lists: 7. Escape bullets in a multi-line context
14030 !! input
14031 <nowiki>a
14032 *b</nowiki>
14033 !! result
14034 <p>a
14035 *b
14036 </p>
14037 !!end
14038
14039 #### --------------- HRs ---------------
14040 #### 1. Single line
14041 #### -----------------------------------
14042
14043 !! test
14044 HRs: 1. Single line
14045 !! options
14046 parsoid
14047 !! input
14048 ----<nowiki>----</nowiki>
14049 ----=foo=
14050 ----*foo
14051 !! result
14052 <hr><span typeof="mw:Nowiki">----</span>
14053 <hr>=foo=
14054 <hr>*foo
14055 !! end
14056
14057 #### --------------- Tables ---------------
14058 #### 1a. Simple example
14059 #### 1b. No escaping needed (!foo)
14060 #### 1c. No escaping needed (|foo)
14061 #### 1d. No escaping needed (|}foo)
14062 ####
14063 #### 2a. Nested in td (<td>foo|bar</td>)
14064 #### 2b. Nested in td (<td>foo||bar</td>)
14065 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
14066 ####
14067 #### 3a. Nested in th (<th>foo!bar</th>)
14068 #### 3b. Nested in th (<th>foo!!bar</th>)
14069 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
14070 ####
14071 #### 4a. Escape -
14072 #### 4b. Escape +
14073 #### 4c. No escaping needed
14074 #### --------------------------------------
14075
14076 !! test
14077 Tables: 1a. Simple example
14078 !! input
14079 <nowiki>{|
14080 |}</nowiki>
14081 !! result
14082 <p>{|
14083 |}
14084 </p>
14085 !! end
14086
14087 !! test
14088 Tables: 1b. No escaping needed
14089 !! input
14090 !foo
14091 !! result
14092 <p>!foo
14093 </p>
14094 !! end
14095
14096 !! test
14097 Tables: 1c. No escaping needed
14098 !! input
14099 |foo
14100 !! result
14101 <p>|foo
14102 </p>
14103 !! end
14104
14105 !! test
14106 Tables: 1d. No escaping needed
14107 !! input
14108 |}foo
14109 !! result
14110 <p>|}foo
14111 </p>
14112 !! end
14113
14114 !! test
14115 Tables: 2a. Nested in td
14116 !! options
14117 parsoid
14118 !! input
14119 {|
14120 |<nowiki>foo|bar</nowiki>
14121 |}
14122 !! result
14123 <table><tbody><tr>
14124 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
14125 !! end
14126
14127 !! test
14128 Tables: 2b. Nested in td
14129 !! options
14130 parsoid
14131 !! input
14132 {|
14133 |<nowiki>foo||bar</nowiki>
14134 |''it''<nowiki>foo||bar</nowiki>
14135 |}
14136 !! result
14137 <table><tbody><tr>
14138 <td><span typeof="mw:Nowiki">foo||bar</span></td>
14139 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
14140 !! end
14141
14142 !! test
14143 Tables: 2c. Nested in td -- no escaping needed
14144 !! options
14145 parsoid
14146 !! input
14147 {|
14148 |foo!!bar
14149 |}
14150 !! result
14151 <table><tbody><tr><td>foo!!bar
14152 </td></tr></tbody></table>
14153
14154 !! end
14155
14156 !! test
14157 Tables: 3a. Nested in th
14158 !! options
14159 parsoid
14160 !! input
14161 {|
14162 !foo!bar
14163 |}
14164 !! result
14165 <table><tbody><tr><th>foo!bar
14166 </th></tr></tbody></table>
14167
14168 !! end
14169
14170 !! test
14171 Tables: 3b. Nested in th
14172 !! options
14173 parsoid
14174 !! input
14175 {|
14176 !<nowiki>foo!!bar</nowiki>
14177 |}
14178 !! result
14179 <table>
14180 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
14181 </tbody></table>
14182 !! end
14183
14184 !! test
14185 Tables: 3c. Nested in th -- no escaping needed
14186 !! options
14187 parsoid
14188 !! input
14189 {|
14190 !<nowiki>foo||bar</nowiki>
14191 |}
14192 !! result
14193 <table><tbody><tr>
14194 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
14195 !! end
14196
14197 !! test
14198 Tables: 4a. Escape -
14199 !! options
14200 parsoid
14201 !! input
14202 {|
14203 |-
14204 !-bar
14205 |-
14206 |<nowiki>-bar</nowiki>
14207 |}
14208 !! result
14209 <table><tbody>
14210 <tr><th>-bar</th></tr>
14211 <tr>
14212 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
14213 !! end
14214
14215 !! test
14216 Tables: 4b. Escape +
14217 !! options
14218 parsoid
14219 !! input
14220 {|
14221 |-
14222 !+bar
14223 |-
14224 |<nowiki>+bar</nowiki>
14225 |}
14226 !! result
14227 <table><tbody>
14228 <tr><th>+bar</th></tr>
14229 <tr>
14230 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
14231 !! end
14232
14233 !! test
14234 Tables: 4c. No escaping needed
14235 !! options
14236 parsoid
14237 !! input
14238 {|
14239 |-
14240 |foo-bar
14241 |foo+bar
14242 |-
14243 |''foo''-bar
14244 |''foo''+bar
14245 |}
14246 !! result
14247 <table><tbody>
14248 <tr><td>foo-bar</td><td>foo+bar</td></tr>
14249 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
14250 </tbody></table>
14251 !! end
14252
14253 ### SSS FIXME: Disabled right now because accurate html2wt
14254 ### on this snippet requires data-parsoid flags that we've
14255 ### stripped out of these tests. We should scheme how we
14256 ### we want to handle these kind of tests that require
14257 ### data-parsoid flags for accurate html2wt serialization
14258
14259 !! test
14260 Tables: 4d. No escaping needed
14261 !! options
14262 disabled
14263 !! input
14264 {|
14265 ||+1
14266 ||-2
14267 |}
14268 !! result
14269 <table>
14270 <tr>
14271 <td>+1
14272 </td>
14273 <td>-2
14274 </td></tr></table>
14275
14276 !! end
14277
14278 #### --------------- Links ---------------
14279 #### 1. Quote marks in link text
14280 #### 2. Wikilinks: Escapes needed
14281 #### 3. Wikilinks: No escapes needed
14282 #### 4. Extlinks: Escapes needed
14283 #### 5. Extlinks: No escapes needed
14284 #### --------------------------------------
14285 !! test
14286 Links 1. Quote marks in link text
14287 !! options
14288 parsoid
14289 !! input
14290 [[Foo|<nowiki>Foo''boo''</nowiki>]]
14291 !! result
14292 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
14293 !! end
14294
14295 !! test
14296 Links 2. WikiLinks: Escapes needed
14297 !! options
14298 parsoid
14299 !! input
14300 [[Foo|<nowiki>[Foobar]</nowiki>]]
14301 [[Foo|<nowiki>Foobar]</nowiki>]]
14302 [[Foo|x [Foobar] x]]
14303 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
14304 [[Foo|<nowiki>[[Bar]]</nowiki>]]
14305 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
14306 [[Foo|<nowiki>|Bar</nowiki>]]
14307 [[Foo|<nowiki>]]bar</nowiki>]]
14308 [[Foo|<nowiki>[[bar</nowiki>]]
14309 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
14310 !! result
14311 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
14312 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
14313 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
14314 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
14315 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
14316 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
14317 <a href="Foo" rel="mw:WikiLink">|Bar</a>
14318 <a href="Foo" rel="mw:WikiLink">]]bar</a>
14319 <a href="Foo" rel="mw:WikiLink">[[bar</a>
14320 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
14321 !! end
14322
14323 !! test
14324 Links 3. WikiLinks: No escapes needed
14325 !! options
14326 parsoid
14327 !! input
14328 [[Foo|[Foobar]]
14329 [[Foo|foo|bar]]
14330 !! result
14331 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
14332 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
14333 !! end
14334
14335 !! test
14336 Links 4. ExtLinks: Escapes needed
14337 !! options
14338 parsoid
14339 !! input
14340 [http://google.com <nowiki>[google]</nowiki>]
14341 [http://google.com <nowiki>google]</nowiki>]
14342 !! result
14343 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
14344 <a href="http://google.com" rel="mw:ExtLink">google]</a>
14345 !! end
14346
14347 !! test
14348 Links 5. ExtLinks: No escapes needed
14349 !! options
14350 parsoid
14351 !! input
14352 [http://google.com [google]
14353 !! result
14354 <a href="http://google.com" rel="mw:ExtLink">[google</a>
14355 !! end
14356
14357 #### --------------- Quotes ---------------
14358 #### 1. Quotes inside <b> and <i>
14359 #### 2. Link fragments separated by <i> and <b> tags
14360 #### 3. Link fragments inside <i> and <b>
14361 #### --------------------------------------
14362 !! test
14363 1. Quotes inside <b> and <i>
14364 !! input
14365 ''<nowiki>'foo'</nowiki>''
14366 ''<nowiki>''foo''</nowiki>''
14367 ''<nowiki>'''foo'''</nowiki>''
14368 '''<nowiki>'foo'</nowiki>'''
14369 '''<nowiki>''foo''</nowiki>'''
14370 '''<nowiki>'''foo'''</nowiki>'''
14371 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
14372 !! result
14373 <p><i>'foo'</i>
14374 <i>''foo''</i>
14375 <i>'''foo'''</i>
14376 <b>'foo'</b>
14377 <b>''foo''</b>
14378 <b>'''foo'''</b>
14379 <b>foo'<i>bar'</i>baz</b>
14380 </p>
14381 !! end
14382
14383 !! test
14384 2. Link fragments separated by <i> and <b> tags
14385 !! input
14386 [[''foo''<nowiki>hello]]</nowiki>
14387
14388 [['''foo'''<nowiki>hello]]</nowiki>
14389 !! result
14390 <p>[[<i>foo</i>hello]]
14391 </p><p>[[<b>foo</b>hello]]
14392 </p>
14393 !! end
14394
14395 !! test
14396 2. Link fragments inside <i> and <b>
14397 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
14398 this is one of the shortcomings of this format)
14399 !! input
14400 ''[[foo''<nowiki>]]</nowiki>
14401
14402 '''[[foo'''<nowiki>]]</nowiki>
14403 !! result
14404 <p><i>[[foo</i>]]
14405 </p><p><b>[[foo</b>]]
14406 </p>
14407 !! end
14408
14409 #### --------------- Paragraphs ---------------
14410 #### 1. No unnecessary escapes
14411 #### --------------------------------------
14412
14413 !! test
14414 1. No unnecessary escapes
14415 !! input
14416 bar <span><nowiki>[[foo]]</nowiki></span>
14417
14418 =bar <span><nowiki>[[foo]]</nowiki></span>
14419
14420 [[bar <span><nowiki>[[foo]]</nowiki></span>
14421
14422 ]]bar <span><nowiki>[[foo]]</nowiki></span>
14423
14424 =bar <span>foo]]</span><nowiki>=</nowiki>
14425 !! result
14426 <p>bar <span>[[foo]]</span>
14427 </p><p>=bar <span>[[foo]]</span>
14428 </p><p>[[bar <span>[[foo]]</span>
14429 </p><p>]]bar <span>[[foo]]</span>
14430 </p><p>=bar <span>foo]]</span>=
14431 </p>
14432 !!end
14433
14434 #### --------------- PRE ------------------
14435 #### 1. Leading space in SOL context should be escaped
14436 #### --------------------------------------
14437 !! test
14438 1. Leading space in SOL context should be escaped
14439 !! options
14440 parsoid
14441 !! input
14442 <nowiki> foo</nowiki>
14443 <!--cmt--><nowiki> foo</nowiki>
14444 !! result
14445 <p> foo
14446 <!--cmt--> foo
14447 </p>
14448 !! end
14449
14450 #### --------------- HTML tags ---------------
14451 #### 1. a tags
14452 #### 2. other tags
14453 #### 3. multi-line html tag
14454 #### --------------------------------------
14455 !! test
14456 1. a tags
14457 !! options
14458 parsoid
14459 !! input
14460 <a href="http://google.com">google</a>
14461 !! result
14462 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
14463 !! end
14464
14465 !! test
14466 2. other tags
14467 !! input
14468 <nowiki><div>foo</div>
14469 <div style="color:red">foo</div></nowiki>
14470 !! result
14471 <p>&lt;div&gt;foo&lt;/div&gt;
14472 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
14473 </p>
14474 !! end
14475
14476 !! test
14477 3. multi-line html tag
14478 !! input
14479 <nowiki><div
14480 >foo</div
14481 ></nowiki>
14482 !! result
14483 <p>&lt;div
14484 &gt;foo&lt;/div
14485 &gt;
14486 </p>
14487 !! end
14488
14489 #### --------------- Others ---------------
14490 !! test
14491 Escaping nowikis
14492 !! input
14493 &lt;nowiki&gt;foo&lt;/nowiki&gt;
14494 !! result
14495 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
14496 </p>
14497 !! end
14498 !! test
14499
14500 Tag-like HTML structures are passed through as text
14501 !! input
14502 <x y>
14503
14504 <x.y>
14505
14506 <x-y>
14507
14508 1>2
14509
14510 x<y
14511
14512 a>b
14513
14514 1<d e>f
14515 !! result
14516 <p>&lt;x y&gt;
14517 </p><p>&lt;x.y&gt;
14518 </p><p>&lt;x-y&gt;
14519 </p><p>1&gt;2
14520 </p><p>x&lt;y
14521 </p><p>a&gt;b
14522 </p><p>1&lt;d e&gt;f
14523 </p>
14524 !! end
14525
14526
14527 # This fails in the PHP parser (see bug 40670,
14528 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
14529 !! test
14530 Tag names followed by punctuation should not be recognized as tags
14531 !! options
14532 parsoid
14533 !! input
14534 <s.ome> text
14535 !! result
14536 <p>&lt;s.ome&gt; text
14537 </p>
14538 !! end
14539
14540 !! test
14541 HTML tag with necessary entities in attributes
14542 !! input
14543 <span title="&amp;amp;">foo</span>
14544 !! result
14545 <p><span title="&amp;amp;">foo</span>
14546 </p>
14547 !! end
14548
14549 !! test
14550 HTML tag with 'unnecessary' entity encoding in attributes
14551 !! input
14552 <span title="&amp;">foo</span>
14553 !! result
14554 <p><span title="&amp;">foo</span>
14555 </p>
14556 !! end
14557
14558 !! test
14559 HTML tag with broken attribute value quoting
14560 !! input
14561 <span title="Hello world>Foo</span>
14562 !! result
14563 <p><span>Foo</span>
14564 </p>
14565 !! end
14566
14567 !! test
14568 Parsoid-only: HTML tag with broken attribute value quoting
14569 !! options
14570 parsoid
14571 !! input
14572 <span title="Hello world>Foo</span>
14573 !! result
14574 <p><span title="Hello world">Foo</span>
14575 </p>
14576 !! end
14577
14578 !! test
14579 Table with broken attribute value quoting
14580 !! input
14581 {|
14582 | title="Hello world|Foo
14583 |}
14584 !! result
14585 <table>
14586 <tr>
14587 <td>Foo
14588 </td></tr></table>
14589
14590 !! end
14591
14592 !! test
14593 Table with broken attribute value quoting on consecutive lines
14594 !! input
14595 {|
14596 | title="Hello world|Foo
14597 | style="color:red|Bar
14598 |}
14599 !! result
14600 <table>
14601 <tr>
14602 <td>Foo
14603 </td>
14604 <td>Bar
14605 </td></tr></table>
14606
14607 !! end
14608
14609 !! test
14610 Parsoid-only: Table with broken attribute value quoting on consecutive lines
14611 !! options
14612 parsoid
14613 !! input
14614 {|
14615 | title="Hello world|Foo
14616 | style="color:red|Bar
14617 |}
14618 !! result
14619 <table><tbody>
14620 <tr>
14621 <td title="Hello world">Foo
14622 </td><td style="color: red">Bar
14623 </td></tr></tbody></table>
14624
14625 !! end
14626
14627 !! test
14628 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14629 !! options
14630 parsoid
14631 !! input
14632 {{}}
14633 !! result
14634 {{}}
14635 !! end
14636
14637 !! test
14638 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14639 !! options
14640 parsoid
14641 !! input
14642 }}{{
14643 !! result
14644 }}{{
14645 !! end
14646
14647 !!test
14648 Accept empty td cell attribute
14649 !!input
14650 {|
14651 | align="center" | foo || |
14652 |}
14653 !!result
14654 <table>
14655 <tr>
14656 <td align="center"> foo </td>
14657 <td>
14658 </td></tr></table>
14659
14660 !!end
14661
14662 !!test
14663 Non-empty attributes in th-cells
14664 !!input
14665 {|
14666 ! Foo !! style="color: red" | Bar
14667 |}
14668 !!result
14669 <table>
14670 <tr>
14671 <th> Foo </th>
14672 <th style="color: red"> Bar
14673 </th></tr></table>
14674
14675 !!end
14676
14677 !!test
14678 Accept empty attributes in th-cells
14679 !!input
14680 {|
14681 !| foo !!| bar
14682 |}
14683 !!result
14684 <table>
14685 <tr>
14686 <th> foo </th>
14687 <th> bar
14688 </th></tr></table>
14689
14690 !!end
14691
14692 !!test
14693 Empty table rows go away
14694 !!input
14695 {|
14696 | Hello
14697 | there
14698 |- class="foo"
14699 |-
14700 |}
14701 !! result
14702 <table>
14703 <tr>
14704 <td> Hello
14705 </td>
14706 <td> there
14707 </td></tr>
14708
14709 </table>
14710
14711 !! end
14712
14713 ###
14714 ### Parsoid-centric tests for testing RTing of inter-element separators
14715 ### Edge cases not tested by existing parser tests and specific to
14716 ### Parsoid-specific serialization strategies.
14717 ###
14718
14719 !!test
14720 RT-ed inter-element separators should be valid separators
14721 !!input
14722 {|
14723 |- [[foo]]
14724 |}
14725 !!result
14726 <table>
14727
14728 </table>
14729
14730 !!end
14731
14732 !!test
14733 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
14734 (Parsoid-only since PHP parser relies on Tidy for correct output)
14735 !!options
14736 parsoid
14737 !!input
14738 {|
14739 |<small>foo
14740 bar
14741 |}
14742
14743 {|
14744 |<small>foo<small>
14745 |}
14746 !!result
14747 !!end
14748
14749 !!test
14750 Empty TD followed by TD with tpl-generated attribute
14751 !!input
14752 {|
14753 |-
14754 |
14755 |{{echo|style='color:red'}}|foo
14756 |}
14757 !!result
14758 <table>
14759
14760 <tr>
14761 <td>
14762 </td>
14763 <td>foo
14764 </td></tr></table>
14765
14766 !!end
14767
14768 !!test
14769 Indented table with an empty td
14770 !!input
14771 {|
14772 |-
14773 |
14774 |foo
14775 |}
14776 !!result
14777 <table>
14778
14779 <tr>
14780 <td>
14781 </td>
14782 <td>foo
14783 </td></tr></table>
14784
14785 !!end
14786
14787 !!test
14788 Empty TR followed by a template-generated TR
14789 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
14790 !!options
14791 parsoid=wt2html,wt2wt
14792 !!input
14793 {|
14794 |-
14795 {{echo|<tr><td>foo</td></tr>}}
14796 |}
14797 !!result
14798 <table>
14799 <tbody>
14800 <tr></tr>
14801 <tr typeof="mw:Object/Template">
14802 <td>foo</td></tr></tbody></table>
14803 !!end
14804
14805 ## PHP and parsoid output differ for this, and since this is primarily
14806 ## for testing Parsoid's serializer, marking this Parsoid only
14807 !!test
14808 Empty TR followed by mixed-ws-comment line should RT correctly
14809 !!options
14810 parsoid
14811 !!input
14812 {|
14813 |-
14814 <!--c-->
14815 |-
14816 <!--c--> <!--d-->
14817 |}
14818 !!result
14819 <table>
14820 <tbody>
14821 <tr>
14822 <td> <!--c--></td></tr>
14823 <tr>
14824 <td><!--c--> <!--d--></td></tr>
14825 </tbody></table>
14826
14827 !!end
14828
14829 !!test
14830 Multi-line image caption generated by templates with/without trailing newlines
14831 !!options
14832 parsoid
14833 !!input
14834 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
14835 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
14836 !!result
14837 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC</div></div></div>
14838 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div>
14839
14840 !!end
14841
14842 ## PHP emits broken html for this, and since this is primarily
14843 ## a Parsoid serializer test, marking this Parsoid only
14844 !!test
14845 Improperly nested inline or quotes tags with whitespace in between
14846 !!options
14847 parsoid
14848 !!input
14849 <span> <s>x</span> </s>
14850 ''' ''x''' ''
14851 !!result
14852 <p><span> <s>x</s></span><s> </s>
14853 <b> <i>x</i></b><i> </i>
14854 </p>
14855 !!end
14856
14857 TODO:
14858 more images
14859 more tables
14860 character entities
14861 and much more
14862 Try for 100% code coverage